//update RGB texture private void UpdateTextureImage() { int size = 0; //copy pixel data from unmanaged memory IntPtr ptr = KinectWrapper.GetTextureImage(ref size); if (ptr != IntPtr.Zero) { Marshal.Copy(ptr, seqTex, 0, size); //Debug.Log(size.ToString()); //create color matrix for (int i = 0; i < (IM_W * IM_H * 4); i += 4) { cols[(IM_W * IM_H) - (i / 4) - 1] = new Color32(seqTex[i + 2], seqTex[i + 1], seqTex[i], 255); } //set texture texture.SetPixels32(cols); texture.Apply(); } }