- Home /
setpixels throws Unity Runtime Error
I try to write an App which displays the cam-image of a smartphone flipped on a plane. Because WebCamTexture doesn't allow it to be transformed/modified I want to copy the image from "mCamera" into the Texture2D element "texture":
Color32[] pixels = new Color32[mCamera.width*mCamera.height];
mCamera.GetPixels32 (pixels);
texture.SetPixels32 (pixels);
But "texture" stays empty. And when I debug and step into setpixels32 i get three errors:
System.Exception..ctor (message="A Unity Runtime error occurred!") in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Exception.cs:81
System.SystemException..ctor (message="A Unity Runtime error occurred!") in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/SystemException.cs
UnityEngine.UnassignedReferenceException..ctor () in C:\buildslave\unity\build\Runtime\Export\StackTrace.cs
Do you know what I'm doing wrong?