Topic has a solution and is locked
Topic locked

Access the Camera Image, error creating the texture

Unity Editor
May 7, 2022 - 2:11am #1
Topic solved


I've found a mistake in the example script CameraImageAccess for getting the camera texture.

There is a problem when calling:


The problem is that, in the example script, the Texture2D has not been created.
I've fixed this by adding this line at the end of the Start method:

texture = new Texture2D(Screen.width, Screen.height);

However, although the error is gone, I still cannot see the camera texture (I apply it to a material with the following line):

meshRenderer.materials[0].mainTexture = texture; // meshRenderer.materials assigned from the inspector


Access the Camera Image, error creating the texture

June 29, 2022 - 6:16am #3

Hey there,


Thank you once again for reporting the discrepancy in our documentation.

We have updated the article to reflect the reported problem! 


Kind regards,

Patrick Scheper

Technical Community Manager

Access the Camera Image, error creating the texture

May 10, 2022 - 2:23pm #2


Thank you for the report. We acknowledge the issue and will work to update accordingly.

In the meantime, here are some suggestions:

  • Applying texture, texture.Apply() after image.CopyBufferToTexture(texture)
  • Set Texture2D format to RGB24
  • Check if meshRenderer is of the correct class type and maybe change to RawImage

We're also aware of challenges with different image pixel formats when you run it in Unity Play mode or on mobile (iOS/Android), so your mileage may vary on these suggestions.

Kind regards,

Dave Downing

Vuforia Engine Technical Support

Topic locked