public bool OnLoad(RSRenderCommand command, RSService service, byte[] data) { if (GetComponent <RawImage>() != null) { Texture2D t2d = null; if (GetComponent <RawImage>() == null || (newResolution && newWidth > 0 && newHeight > 0)) { newResolution = false; t2d = new Texture2D(newWidth, newHeight); GetComponent <RawImage>().texture = t2d; } else { t2d = GetComponent <RawImage>().texture as Texture2D; } if (t2d != null && data != null) { t2d.LoadImage(data); } } return(true); }
public bool OnLoad(RSRenderCommand command, RSService service, byte[] data) { // Updating the texture has to be done in the game loop and not from a different thread. lock (DataLock) { CurrentData = data; HasNewData = true; } return(true); }