Search Unity

Accessing text from a script

Discussion in 'UGUI & TextMesh Pro' started by Mutaz, Aug 30, 2014.

  1. Mutaz

    Mutaz

    Joined:
    Sep 9, 2013
    Posts:
    14
    Hi everyone,
    I am wondering how can I access the text script in the new UI Text from a script
    Thanks in advance.
     
  2. JAKJ

    JAKJ

    Joined:
    Aug 17, 2014
    Posts:
    185
    GetComponent < Text > ( ) . text
     
  3. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    Use getcomponent <text>(). If u need text component from seperate go then first use transform.find ("nameGO") then getcomponent as previous mentioned
     
  4. Mutaz

    Mutaz

    Joined:
    Sep 9, 2013
    Posts:
    14
    Hi,
    I tried to do what you told me, but it didn't work.
     
  5. JAKJ

    JAKJ

    Joined:
    Aug 17, 2014
    Posts:
    185
    Hi, I tried to figure out what's going on with your program with no information whatsoever, but it didn't work.