Search Unity

GetCompanent

Discussion in 'Scripting' started by petea, Apr 21, 2014.

  1. petea

    petea

    Joined:
    Nov 29, 2013
    Posts:
    55
    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'.
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  3. wccrawford

    wccrawford

    Joined:
    Sep 30, 2011
    Posts:
    2,039
    Capitalization and spelling matter.
     
  4. petea

    petea

    Joined:
    Nov 29, 2013
    Posts:
    55
    no undestend you wccrawford. tell me object 3dtext
     
    Last edited: Apr 23, 2014
  5. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    - MyDown is not the same thing as Mydown.
    - Input code isn't going to work in Start()
    - The method is GetComponent not GetCompanet
     
  6. petea

    petea

    Joined:
    Nov 29, 2013
    Posts:
    55
    this is understandable, but it no undestend where to take classes