- Home /
Attaching multiple animation events to player
I have searched in Unity for several days now when im off work and others sources but i cannot seem to find an answer to this. If i have a player and lets say a red ball hits my player and the player goes on fire...ok easy enough i did that but now i wanna add to the code below under the IF statement that a blue ball hits my player and freezes or a black ball and causes death animation...but its just not working out to add multiple animation events to 1 player. I just started coding 4 months ago so im green but thanks to all who read and helped..i will mark as correct. void OnTriggerEnter2D(Collider2D collisionObject) { if (collisionObject.gameObject.tag == "redball") {
PlayGone();
Destroy(gameObject);
}
}
void PlayGone()
{
GameObject gone = (GameObject)Instantiate(GoneGo);
gone.transform.position = transform.position;
}
}
Answer by p1g30n · Dec 26, 2015 at 11:11 AM
Are you using an animator? It's really easy to configure all your animations there. You can use this video to figure out what to do. Animations and animator starts on ~30 min. https://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers?playlist=17093 I'm really green too, so sorry if it doesn't help.
Its all good man i really appreciate your help, we all have to start somewhere haha...I never in a million years thought id even attempt coding but look here we are.
Your answer
Follow this Question
Related Questions
How do I make animation transitions a one-way street? 1 Answer
Sprite-based animation not loading with Animation component 0 Answers
How to let death animation play when enemy dies, and stop player from taking damage 1 Answer
Why aren't my parameters for animation not working? 0 Answers
Collision on specific Frames 1 Answer