I’ve been trying to find out why the “current_Treasure” isn’t changing when I try to from the collision method.
This is the entire script. Nothing else changes anything here.
public int max_Treasure;
public int current_Treasure;
void Start()
{
max_Treasure = GameObject.FindGameObjectsWithTag("Treasure").Length;
}
void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Player"))
{
current_Treasure += 1;
Destroy(gameObject);
}
}