|
how do you switch between cameras in javascript? I've tried gameObject.Find("cam1").GetComponent("Camera").active = true/false but it's not working, an error comes up that says "NullReferenceExeption" so is there any other way?
(comments are locked)
|
|
i would use something like this : thank you! it worked
Aug 17 '10 at 08:47 AM
Unity Noob
please mark a accepted answer if it worked!
Aug 17 '10 at 12:49 PM
3dDude
this doesn't work for me, for some reason I can't use the cameras as variabels, wel I'l have to look some more
Apr 23 at 01:12 PM
yu-gi-master
(comments are locked)
|
|
The Null reference exception is coming up because Unity cannot find a GameObject with name - "cam1". Instead you can try using an If condition to check if the GameObject exists and then change the settings. I think the code should be something like this -
(comments are locked)
|
