Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

TextRenderer

Discussion in 'Editor & General Support' started by nickavv, Sep 13, 2007.

  1. nickavv

    nickavv

    Joined:
    Aug 2, 2006
    Posts:
    1,801
    Code (csharp):
    1.  
    2. MissingFieldException: Cannot find variable text.
    3. Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value)
    4. scoreCounter.Update ()   (at Assets/Working Assets/Scripts/scoreCounter.js:4)
    I get this error from this script:

    Code (csharp):
    1. static var score = 0;
    2.  
    3. function Update () {
    4.     GetComponent (TextMesh).text = score;
    5. }
    I don't understand what's going on!
     
  2. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Try this:

    Code (csharp):
    1. static var score = 0;
    2.  
    3. function Update () {
    4.    GetComponent (TextMesh).text = score.ToString ();
    5. }
     
  3. nickavv

    nickavv

    Joined:
    Aug 2, 2006
    Posts:
    1,801
    Wow Daniel, does your helpfulness ever cease? :D You've answered every question I posted today!

    Thanks again!