Search code examples
c#visual-studiounity-game-enginegame-physics

Unity2D issue with colliders


this is how the collisions work in the editor, and how the collisions should work: https://gyazo.com/4e690245b60ff7507ec8828c990d2f1a

but when I build the game, this happens: https://gyazo.com/47a85c09c0eabe340d49bb5a3c16bf9c

It works fine in the editor, (sword hits bad guy, bad guy takes damage, bad guy hits the player, the player dies) but when I build the game, the sword doesn't register a hit from the bad guy. neither does the player. The bad guys only take damage if they hit themselves?


Solution

  • Build the project as a development build, and try running that to see if any errors are printed.

    One possible cause is that Unity is not properly building out the tags. To diagnose this, go into your tag list and try to add a new tag. This may reveal that Unity was only caching the tags in the UI. If that is the case, you will have to re-add all of your tags and then put them on your prefabs/objects again.