Tell me how to return the name of Campanet and where the error. #pragma strict private var Mydown; function Start () { if(Input.GetKeyUp(KeyCode.Space)) { MyDown = GetCompanent(NewText); Mydown.enebled = !Mydown.enebled; } } function Update () { } Assets/NewBehaviourScript.js(7,17): BCE0005: Unknown identifier: 'MyDown'.
First, please use code tags: http://forum.unity3d.com/threads/143875-Using-code-tags-properly And if you get a bunch of error messages in the console, the first one is the most important one. If you have a close look at the documentation of GetComponent, you will already see many mistakes you have made: https://docs.unity3d.com/Documentation/ScriptReference/GameObject.GetComponent.html
- MyDown is not the same thing as Mydown. - Input code isn't going to work in Start() - The method is GetComponent not GetCompanet