i made a script that would increase the coin counter by 1 everytime it collides with a coin but my script either adds 2 or doesnt do anything. Anyone know how to fix this script?Thanks
public int coin = 0;
public GUISkin myskin;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "coin") {
coin += 1;
}
}
void OnGUI()
{
GUI.skin = myskin;
GUI.Label(new Rect(200,10,200,100), "Coins:" + coin);
}