I’m having a problem with OnTriggerStay2D and OnTriggerEnter2D.
Basically, I’ve two characters and a door. If the door trigger is being activated and you press ‘u’ while over a door, you move through the door. Except no matter what, it always only works for one of the characters.
If I use OnTriggerStay2D, CharA causes the trigger to fire every frame, so he can enter the door. When I use OnTriggerEnter2D, CharB causes it to fire everyframe, so he can enter the door. But Char B doesn’t work with OnTriggerStay2D and, likewise, charA doesn’t work with OnTriggerEnter2D.
Both chars are set up the same way; they’ve different sprites and animations, but they all have the same types of colliders, rigidbodies, tag names, layers, etc etc.
Any idea what could be causing this?
Hi Snowcat. What do you mean by 'use Animation control the collider2D.enabled'? Is this something on the characters Animator component, or in the code?
– PotatoInsertionI mean animation clip which is in animator. I got a screenshot make it more clear. [19271-animation+panel.jpg|19271]
– SnowCat[19289-animation1.png|19289] Am I missing something here? I'm not seeing that. Or the sprite, just transforms.
– PotatoInsertionthen you meet a new situation. not same as mine. you may try remove animator of both character and test again. i think the only different between your 2 character is animation, right?
– SnowCatSorry for the delay getting back to you, only just got a chance to get back to this now. Anyway, it does have something to do with the animation. Both characters work with OnTriggerStay2D when I turn off their animators. No idea why though. I'll do some more troubleshooting and maybe I can find a solution. Thanks for helping me isolate the issue.
– PotatoInsertion