- Home /
RealTime image put on a Canvas
Just wondering if I could take an image from a camera that is viewing only an object on a different layer and take that, convert it to an image and put that on a canvas?
Initially I was just trying to use my camera to overlay my image onto the canvas, but this is not seeming to work. Thank you!
~WM
Answer by DiegoSLTS · Apr 03, 2015 at 01:58 AM
Yes, you can. Search for "render textures". You create a render texture in your hierarchy (or at runtime with code), then set that render texture as the render target of your camera.
Also, you need a "Raw Image" component instead of an "Image" one, that should have a reference to the render texture.
This link talks about RenderTexture: http://docs.unity3d.com/Manual/class-RenderTexture.html
This one talks about RawImage: http://docs.unity3d.com/Manual/script-RawImage.html
Thank you so much! Sorry for the late comment, just wanted to figure out all the kinks so I didn't have to ask more questions! Thank you!
Answer by GameDev_Chuck · Apr 03, 2015 at 04:02 AM
This video from the live training courses goes over this exact subject and provides an example:
Also, thank you! The demonstration was a great visual help! ^.^
Hi, has anyone else the problem, that when you try deploy the solution from the video, it only works in the editor, not the build? sadly that is my case... :(
Your answer