Quantcast
Channel: Answers by "ransomink"
Viewing all articles
Browse latest Browse all 80

Answer by ransomink

$
0
0
First, you must have a reference to the script you wish to enable/disable. You can make this a public variable and drag the gameobject using the script into the inspector: public var scriptName : ScriptName; This method is good to use if you know exactly what gameobject is using the script or if it's already in the scene. You then enable/disable the script like so: scriptName.enabled = true; scriptName.enabled = false; Or you can grab the component from the gameobject using it: public var scriptName : ScriptName; public var gameobjectUsingScript : GameObject; scriptName = gameobjectUsingScript.GetComponent( ScriptName ); then enable/disable the script like so: scriptName.enabled = true; scriptName.enabled = false;

Viewing all articles
Browse latest Browse all 80

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>