ToString() not working from other script

Hi again all!

I’m at a loss here and its driving nuts!

i have two scripts.

The first script has a function in it:

public Text scoreLabel;                                         
public static int totalScore;
public string convertedToString; 

 public void updateScoreBoard(int amount){

         totalScore += amount;  //add the amount that was passed to the score
          convertedToString = totalScore.ToString("F0");
          scoreLabel.text = convertedToString;

}

The second script calls the function:

myGutterCheckScript.updateScoreBoard(200);

My problem is that the variable will not display on the UI text field. It will do it locally if i call the function from the first script but will not update from the second script. Everything is linked as i have printed out the variable though when it gets to the part where it converts it to a string… nothing happens. what gives?

cheers peeps

I guess this question is related to your other question. I just wrote an answer over there. This should fix this problem as well.

You should spend some time to learn the basic concepts of Unity. How to deal with components, how to communicate between scripts and things like that are very fundamental things which are explained in the learning section as well as the basic training section