Search Unity

Problem Getting Component Text not GUIText

Discussion in 'Scripting' started by blackant, May 2, 2016.

  1. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    529
    Hi,

    I'm trying to solve a problem with this script used in unity platformer2D.

    The UI is made using GUI text and my game is using New TExt UI component.
    so, if i keep this like that, unity can't find the GUIText element, what shoul i use to find it ?



    // Update is called once per frame
    void Update () {

    // écrire le nombre de pieces
    GetComponent<GUIText>().text = PlayerControl.pieceQtt.ToString();

    } Screenshot at 2016-05-02 10 21 47.png
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    Kiwasi likes this.
  3. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    529
    thanks i fund it this morning finally ^^'