Search Unity

Need Help If GameObject.Find

Discussion in 'Scripting' started by jroto23, Nov 28, 2015.

  1. jroto23

    jroto23

    Joined:
    Oct 19, 2015
    Posts:
    82
    How can I cast this to an Input Field so I can find the object text value?
    It doesn't like the line below

    InputField txtGameName = GameObject.Find("txtGameName");
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Use GetComponent
     
  3. jroto23

    jroto23

    Joined:
    Oct 19, 2015
    Posts:
    82
    thanks man!