Answer by Hybris
I think it has to be: `gameObject.GetComponent(Script).enabled` If that doesn't work try making a variable out of the GameObject the script is attached to. or try `GetComponent("Script"//or just...
View ArticleAnswer by Kryptos
Once again. NEVER use the *string-based* version of the method GetComponent which returns a Component (the compiler cannot infer the type). Instead, use the *type-based* method: // JS...
View ArticleAnswer by Ninita
or you could do `(gameObject.GetComponent( "Script" ) as MonoBehaviour).enabled = true;`
View ArticleAnswer by frogsbo
works: ` `camera.main.gameObject.GetComponent(MouseOrbit).enabled = true ;
View ArticleAnswer by Michio Magic
I had to use this > to access the First Person Controller component ... gameObject.GetComponent(UnityStandardAssets.Characters.FirstPerson.FirstPersonController).enabled = false;
View ArticleAnswer by Hybris
I think it has to be: `gameObject.GetComponent(Script).enabled` If that doesn't work try making a variable out of the GameObject the script is attached to. or try `GetComponent("Script"//or just...
View ArticleAnswer by Kryptos
Edit -> Unity 5 : GetComponent("ScriptName") is deprecated (the string version). You must use one of the other versions....
View ArticleAnswer by Ninita
or you could do `(gameObject.GetComponent( "Script" ) as MonoBehaviour).enabled = true;`
View ArticleAnswer by frogsbo
works: ` `camera.main.gameObject.GetComponent(MouseOrbit).enabled = true ;
View ArticleAnswer by Michio Magic
I had to use this > to access the First Person Controller component ... gameObject.GetComponent(UnityStandardAssets.Characters.FirstPerson.FirstPersonController).enabled = false;
View Article
More Pages to Explore .....