Hi, I'm trying to make an object in my game where it's sprite changes once it collides with a certain object, but then changes back to the original sprite after 1-2 seconds. I have the first part, but have no idea how to do the second part. Here's my code so far.
var spriteImage : Sprite;
function OnCollisionEnter2D(col : Collision2D){
if(col.gameObject.tag == "Red") {
GetComponent(SpriteRenderer).sprite = spriteImage;
}
}
Thanks in advance.
↧