//I’m using this inside my gamemanager script
points.text = “Points:” + player.currentPoints.ToString();
// I’m using these inside my player script
internal int currentPoints;
internal int point = 10;
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == “Coin”)
{
currentPoints += point;
Destroy(other.gameObject);
}
}
I have a coin which was supposed to give me 10 points, but sometimes it gives me 10, sometimes 20 or 30. Can anyone explain what’s wrong with my code? (sorry for my english by the way)