CONTEXT: I'm trying to integrate my Kinect v2 with Unity3D on a Mac with OSX 10.10. I have all the needed drivers installed (afaik: libfreenect, openni2, nite, libusb, etc), and I'm using this Unity asset library.
ISSUE: Most of it seems to work, but I'm having an issue with the System.IO.File functions for writing data to files. Compiler errors:
Assets/KinectScripts/KinectWrapper.cs(391,38): error CS0117: 'System.IO.File' does not contain a definition for 'WriteAllText'
Assets/KinectScripts/KinectWrapper.cs(458,38): error CS0117: 'System.IO.File' does not contain a definition for 'WriteAllText'
Assets/KinectScripts/KinectWrapper.cs(536,38): error CS0117: 'System.IO.File' does not contain a definition for 'WriteAllBytes'
It's being called from these sections of code (that I did not write):
L383-399:
if(!File.Exists("OpenNI.ini"))
{
Debug.Log("Copying OpenNI2 configuration...");
TextAsset textRes = Resources.Load("OpenNI.ini", typeof(TextAsset)) as TextAsset;
if(textRes != null)
{
string sResText = textRes.text.Replace("%OPENNI_REDIST_DIR%", sOpenNIPath);
File.WriteAllText("OpenNI.ini", sResText);
bOneCopied = File.Exists("OpenNI.ini");
bAllCopied = bAllCopied && bOneCopied;
if(bOneCopied)
Debug.Log("Copied OpenNI2 configuration.");
}
}
L450-466:
if(!File.Exists("NiTE.ini"))
{
Debug.Log("Copying NiTE2 configuration...");
TextAsset textRes = Resources.Load("NiTE.ini", typeof(TextAsset)) as TextAsset;
if(textRes != null)
{
string sResText = textRes.text.Replace("%NITE_REDIST_DIR%", sNiTEPath);
File.WriteAllText("NiTE.ini", sResText);
bOneCopied = File.Exists("NiTE.ini");
bAllCopied = bAllCopied && bOneCopied;
if(bOneCopied)
Debug.Log("Copied NITE2 configuration.");
}
}
L528-545
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
if(!File.Exists("libUnityInterface2.dylib"))
{
Debug.Log("Copying UnityInterface2 library...");
TextAsset textRes = Resources.Load("libUnityInterface2.dylib", typeof(TextAsset)) as TextAsset;
if(textRes != null)
{
File.WriteAllBytes("libUnityInterface2.dylib", textRes.bytes);
bOneCopied = File.Exists("libUnityInterface2.dylib");
bAllCopied = bAllCopied && bOneCopied;
if(bOneCopied)
Debug.Log("Copied UnityInterface library.");
}
}
#endif
I've spent enough time with this to know that it doesn't look like WriteAllText/Bytes should be throwing this sort of error up since the docs definitely say they exist, but I'm still too new to C# to get what might be happening here. Any guesses what might be causing this?