- Home /
Make an object invisible from 1 camera
I have a scene with differents camera use simultaneously and regarding the same scene. I would like to make an object invisible only from one camera. How can I do ? I tried to attach to my camera this script, but it's not working :
function Update () { myObject.renderer.enabled = false; }
Comment
Answer by robertbu · Jan 14, 2014 at 03:52 PM
The general solution is to put the object on different layers.
http://docs.unity3d.com/Documentation/Components/Layers.html
Then you can set the culling mask for the camera on each camera to only display the layers that you want.
http://docs.unity3d.com/Documentation/Components/class-Camera.html
But wouldn't that stop casting shadows as well? I have that problem.