How can I execute an OnTriggerEnter2D only one time in the scene?
I’ve made an animated checkpoint that when the player walks beside, it starts an animation, but i would like that this animation could only happen once, any idea what should i do?
How can I execute an OnTriggerEnter2D only one time in the scene?
I’ve made an animated checkpoint that when the player walks beside, it starts an animation, but i would like that this animation could only happen once, any idea what should i do?
bool isFirstTime = true;
void OnTriggerEnter2D(Collider2D other)
{
if(isFirstTime)
{
isFirstTime = false;
// do something here.
Debug.Log("Happens only once.");
}
}