below is what you should do
1. Open Unity, add text mesh let say "myText"
2. Create a new javascript and attach it to your button
3. On your javascript put
private var myCredit : int=100;
private var myTextMesh :TextMesh;
function awake()
{
myTextMesh=transform.Find("myText").GetComponent(TextMesh);
}
function OnMouseDown() //when pressing button
{
myCredit += 10;
myTextMesh.text =myCredit.ToString();
}
No comments:
Post a Comment