My Game is a 2D game and i have a pistol sprite in my level and the animation for my player holding it is set up in the animation but how would i say in my script that i want the animation to play and the object to destroy when the player walks over it?
void OnColliderEnter(Collider2D Pistol)
{
Destroy(Pistol.gameObject);
anim.SetTrigger ("isIdlePistol");
Debug.Log ("Picking up pistol");
}
this is the script i used but doesn’t work :/.