- Home /
{Easy question} How to disable script from other gameObject.
Hi,how can i disable script that is in other game object,like it founds that gameobject where is located that script,what i need to disable,and disables it.
Answer by Dave-Carlile · Jan 17, 2013 at 03:06 PM
Unity Gems is a good resource for this sort of thing.
They have a good tutorial on script interaction: http://unitygems.com/script-interaction-tutorial-getcomponent-unityscript/
Answer by Hivemind · Jan 17, 2013 at 03:22 PM
Every script that inherits from monobehaviour has a variable called "enabled".
You would essentially find that object, use getcomponent, and set "enabled" to false.
C# Example:
GameObject.Find("Player").GetComponent.enabled = false;
Your answer
Follow this Question
Related Questions
How to deactivate something when holding down a key? 1 Answer
Access a String array in one script from another script 0 Answers
When all objects with a certain tag has been destroyed, load the next level! 3 Answers
script help gameobject to playercar 1 Answer
Script doesn't find other script 0 Answers