Object getting deleted when it shouldn't

So I have a system in my game where you can step on a button to activate a wire which activates a gun. It works most of the time, but occasionally the wire will just disappear.

Screenshot of code for wires and buttons:


It’s really rare so I can’t even get it on video, but even if it’s rare it could be a game-breaking bug as some levels require you to use a gun in order to proceed

Well if deleting objects has bugs, you should maybe try using sprite animations instead of separate objects

I think is because in the collision the Wire variable Gone is 0 so the deletion event occurs and the Wire is deleted. Make sure when a Wire is Created to set the Gone variable to something different than 0

My suggestion is if that happens is to start the debugger and see if the wire is still on the scene. Could it be that the z-order puts it behind other objects?