hysics2D.GetIgnoreCollision not persisting,physics2d.ignorecollisions not persisting
In my game, I'm trying to make it so that you can't hit the same enemy more than once with the same swing of the sword, but you can still hit other enemies.
The sword's collision is represented by a boxcollider2d.
in OnTriggerEnter2D(), I am calling Physics2D.IgnoreCollision(SwordCollider, collision,true) where SwordCollider is the previously saved boxcollider2d of the sword and collision is the Collider2D given by OnTriggerEnter2D(). I can verify with Physics2D.GetIgnoreCollision(SwordCollider, collision) directly after the ignore call that the ignore has been set, but it will still allow further OnTriggerEnter2D() calls to happen (verified with debug.log) and if I check with GetIgnoreCollision() It returns false each time. it seems to be losing the ignore setting, but I'm not doing anything like turning off the collider or gameobject to cause this.
please help!
Your answer
Follow this Question
Related Questions
Random freezes during the game 0 Answers
destroying a physics object after it starts moving? 1 Answer
Bounce not working when Velocity is below 1f , what could it be? 0 Answers
Linecast not working after Instantiation of a particular object 0 Answers
Is there an easy way to make a RigidBody2D collide with only one other RigidBody2D? 1 Answer