Why do i get the error player.gd:312 @ take_damage(): Removing a CollisionObject node during a physics callback is not allowed and will cause undesired behavior. Remove with call_deferred() instead. When i reset the scene

4.4

I used get_tree().reload_current_scene() to reset the scene when i die, but it keeps saying the collision is getting removed when its not, im just resetting the screne, and when i press the error in debugger it brings me to that line, the line: get_tree().reload_current_scene() that doesnt remove anything, it just resets

When you reload the scene it will internallly free the current scene and instantiate it back. Freeing the scene will free everything in it, collision objects included.

The error should not cause any issues as you are resetting the scene anyway but, if you want to avoid it then you can do what it tells you to do: use call_deferred() like: get_tree().reset_current_scene.call_deferred()

Wow thanks mrcdk! You solved my issue with just one reply on this post!