Hello
I wrote this code:
public class Score : MonoBehaviour
{
public GUIText text1;
public GUIText text2;
public int score1;
public int score2;
public void Update()
{
text1.text = ""+score1;
text1.material.color = Color.red;
text2.text = ""+score2;
text2.material.color = Color.blue;
}
public void plus1()
{
score1 = score1 + 1;
}
public void plus2()
{
score2 = score2 + 1;
}
}
and I try to access it from another one by wirteing
sco = gameObject.GetComponent("Score")as Score;
sco.plus1();
but its not working
how can i write its right?
thx for the help