Title says it all. I simply want to make my player invincible after getting a powerup for a short period of time, so he can’t die from touching the objects that kill him instantly. I tried to look this up on the answered questions that were asked a while back and I could not find someone who asked this question except one guy. It was in java script so it’s like a whole other language to me, also his script gives his player a health bar(which mine doesn’t have, I’m making an infinite runner). Anyways since this is in the answers section I don’t want to make a big discussion out of it, so let’s be direct please or I’ll get in trouble. Here’s my basic powerup script:
public class PowerupScript : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player"){
Destroy (gameObject);
}
{
}
}
}