// Start is called before the first frame update void Start() { //Update the frame with the user NuitrackManager.onUserTrackerUpdate += ColorizeUser; //Mirror the image recieved from the sensor using SetMirror NuitrackManager.DepthSensor.SetMirror(true); //Request the output image parameters from the depth sensor nuitrack.OutputMode mode = NuitrackManager.DepthSensor.GetOutputMode(); cols = mode.XRes; rows = mode.YRes; //Create the rectangle to define the texture boundaries imageRect = new Rect(0, 0, cols, rows); //Create segment texture and specify width and height. segmentTexture = new Texture2D(cols, rows, TextureFormat.ARGB32, false);//ARGB32 format for the texture that supports an Alpha channel 1 byte per each channel //Create an output segment and specify its size in bytes. Multiply the image size by 4 bc there are 4 channels (ARGB32) in every pixel dataSegment = new byte[cols * rows * 4]; //Set Image type to simple (no stretching, etc) retain image aspect ratio segmentOut.type = Image.Type.Simple; segmentOut.preserveAspect = true; //Colliders method pass the columns and rows collider.CreateCollider(cols, rows); //Object method to start random spawn objectSpawner.StartSpawning(cols); }