Disable script using another script

Yeah, how do I do that?

Here is the code you are looking for.

  //Disable another script as soon as your press Play

  function Start () {

  gameObject.Find("gameobject").GetComponent (scriptname).enabled = false;


“gameobject” = the name of the game object that the script is on in the hierarchy.

“scriptname” = the name of the script that is on the game object.

(TIP) - To turn the script back on just change the word (false) to (true).

void Start () {
this.GetComponent().enabled = false;

…or check yt video https://www.youtube.com/watch?v=kgOttwh8-fE

if (GameObject.Find(“yourobjectname”) != null) // just to avoid null pointer exceptions
GameObject.Find(“yourobjectname”).GetComponent().enabled = false;

yourobjectname = Name of your object
that has the script in it

yourscriptname = the script you want
to disable (or enable by replacing
“false” with “true”

Hope this helps it worked fine for me @VLunarFangV