I wrote the following code to keep the score of my game.
#region Score
private GameObject scoreobject;
private int score;
public void InstantiateScore()
{
score = 0;
scoreobject = GameObject.Find("scoretext");
//scoreobject.transform.position = new Vector2(0, 0);
}
public void UpdateScore(){
score++;
scoreobject = GameObject.Find("scoretext");
if (scoreobject)
{
scoreobject.guiText.text = score.ToString();
}
}
#endregion
The problem is in the commented line scoreobject.transform.position = new Vector2(0, 0);
. When I am trying to change the position of my scoreobject, the object is not appeared on the screen.