hey guys, its been quiet a while since i been here , and i finaly start thinking that i was getting into the scripiting and i could now move on without having to ask you guys everty secound what to do, i know thats pretty anoying and lame …
but… yea… my noobness has come up again…
well… theres a certain point in my game that i want to turn the main camera off, or at least the script attached to that camera to folow the character… so i can
A. make the camera go up to show an arial view of the stage
or
B. just turn the main camera off and turn another camera on, this other camera will be already in place in a higher spot…
but this seems impossible… i made a script attached to the floor… and when the character steps on a pre-defined place… this should happen
Hi, if i understand your problem , you want enable and disable the camera.
The code is it :
GameObject.Find(“MainCamera”).enabled= false;
GameObject.Find(“ArialCamera”).enabled= true;
Would work, assuming both objects had a camera component attached.
As for why your method didn’t work, I don’t think there’s enough information in your post to say what the problem is. Does the aerial camera work if you test it directly by making it initially active and the other camera initially inactive?
yes it does… and yes i think i didnt gave enough info about the scripts… the movement script of my character is based on witch angle the camer is gettting him… like,… if the camera is in his back, then the up arrow is set to move forward… if the camera is cathing him from the front, then down arrow is forward…
so, when i turned the cameras i saw an error aperaring during gameplay, it said " not vector reference " or something like that
GameObject.Find() can only return Active objects, for future reference.
In the original, it never found the “ArialCamera” to turn it on, and turned off the “MainCamera” so there were no active cameras.
To get round things like this, keep a variable reference. You always have access and its quicker than Find()