- Home /
Enemy collider used as range to detect player causes player to not go into jump animation, how should I deal with that?
I am making a 2D platform shooter.
Got a player that can jump, run and shoot. All animations working. Basic coding also done for it.
Have an enemy, not completed the coding part for it, animation is done. Can only stay idle, shoot and walk.
It has a box collider on trigger that is being used for it's range to detect player and shoot when player in range.
Now I haven't added any tags or sorted them in layers. Which I feel will solve my problem along with the enemy code once done but at the moment the player does not go into it's jump animation when inside enemy's range. I use a trigger collider for the player as well for ground check for jump.
So what I wish to know is if there anything I should pay attention to when I will be solving this problem?
Note: I am still a beginner with unity but not a complete beginner in C#. Thank you in advance.
You answered your own question already...Tags and Layers are your answer..
You will have to do something like...
OnTriggerStay(Collider2D coll)
{
if( coll.gameObject.tag == "Player" )
{
blah blah kill him
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612112853im_/https://answers.unity.com/themes/thub/images/avi.jpg)