void Awake()
{
// ensure that dll and config are in place
string srcDllPath = Application.dataPath + "/Plugins/UnityInterface.dll";
bool bDllCopied = false;
if(!File.Exists("UnityInterface.dll") && File.Exists(srcDllPath))
{
Debug.Log("Copying UnityInterface.dll ...");
File.Copy(srcDllPath, "UnityInterface.dll");
bDllCopied = File.Exists("UnityInterface.dll");
}
if(!File.Exists("OpenNI.xml"))
{
Debug.Log("Copying OpenNI.xml ...");
TextAsset textRes = Resources.Load("OpenNI", typeof(TextAsset)) as TextAsset;
if(textRes != null)
{
File.WriteAllText("OpenNI.xml", textRes.text);
}
}
if(bDllCopied)
{
// reload the same level
Application.LoadLevel(Application.loadedLevel);
}
}