So I have made this 2d game and I am done with the development of level 1 but now that i have added the restart feature the player does not take damage from the enemies anymore.Please can someone help me out?
Little info to go on but a lot of problems with functionality after reloading a scene are caused by static variable instances. These do not reset on scene loads (which is intended, and allows you to have data persist) but also means in a multi-scene application you need to handle this behaviour. E.g. if a bool ‘dead’ is static, unless it’s explicitly set to false in Start or Awake of a script in the loaded scene, it will remain true. This will differ from the first time the scene loads since if it’s unassigned it will be false by default.