Depth Sensor should be create before ColorSensor ,otherwise It will make a dirty data when calling colorSensor.GetOutputMode().XRes . To be honest I just trying to read the RGB data for display and I can’t read the colorFrame without init the depthSensor .Maybe it’s an issue.
Here is the Untiy C# Code
public class NuiTest : MonoBehaviour
{
nuitrack.ColorSensor colorSensor;
nuitrack.DepthSensor depthSensor;
void Start()
{
nuitrack.Nuitrack.Init();
depthSensor = nuitrack.DepthSensor.Create();// Without this the following debug output would be wrong
colorSensor = nuitrack.ColorSensor.Create();
Debug.Log(“CSLX:” + colorSensor.GetOutputMode().XRes + “,Y:” + colorSensor.GetOutputMode().YRes);
nuitrack.Nuitrack.Run();
}
void OnDestroy()
{
colorSensor.Release();
depthSensor.Release();
nuitrack.Nuitrack.Release();
Debug.Log(“Closing”);
}
}