So i'm trying to do something very simple. I have a player, who shoots a gun, when the bullet hits the enemy the bullet is destroyed and the enemy loses health. I have my bullets in a list, and have their corresponding physics bodies in a list. I've
programmed it so that when the bullet hits a target, it becomes inactive, but is recalled when fired again.
I assign the bullets a collision event with a body.OnCollision += OnCollision. And within my defined OnCollision I detect what the 2 fixtures are and what actions to take. When the bullet strikes anything in the game, which so far is just an
enemy and a platform, it runs
fix1.Body.Enabled = false;
Now this works perfectly when the bullet is colliding with the static ground. I look in debug and the bullet becomes un-enabled and greyed out and everything is fine when its re-enabled and called again. But when it collides with my dynamic enemy, I get
an error "Object reference was not set to an instance of an object" within the Contact.cs file. I look and it turns out the values FixtureA, and FixtureB are null.
Why is this happening? and why does it work when its colliding with my platform object?