A small adjustment to Unity syntax in C#
@Xtro I found a question with an answer named "How to turn off a script in JavaScript" and I want to do the same in C#, but it seems, not very surprisingly that it is different syntax for Javascript and C#.
I tried to write:
private Player_Controller playerController; (Player_Controller is the Script I want to turn off.)
and just where I want it:
gameObject.GetComponent(playerController).enabled = false;
or:
gameObject.GetComponent(Player_Controller).enabled = false;
None of them functioned.
If someone could please tell me the correct syntax for turning off a script in C# I think I will be able to figure out the rest by myself.
Comment