- Home /
iOS deactivating a script deactivates the gameobject
i have just finished an interactive app but built it for web player and i am now converting it to an iOS build. when you click on an object a script attached to the main camera needs to be deactivated but instead of doing this it deactivates the camera. here is the code
Camera.main.GetComponent("RotateCamera").active = false;
how do i convert this to work on iOS? thankyou
Comment
Answer by cj_coimbra · Nov 11, 2011 at 10:56 AM
This is happening because "active" is a GameObject variable, not a property for the script only.
Here check this out: http://unity3d.com/support/documentation/ScriptReference/GameObject-active.html
You will probably need to wrap your script around a boolean and set it true/false instead of activating/deactivating the GameObject. Or you can try "enabled" property.... might work too.