Recursion error and spawning multiple times (buggy physics)

Describe the bug:
Objects with physics occasionally spawn multiple times. Either inside eachother or next to eachother.

How do you cause this bug?
Enable physics on an object.

How regularly do you see this? (E.g. 2/3 times - please try 3 times if possible): it varies a lot and I’m not sure about the replication steps. Additionally it’s hard to tell since they spawn inside eachother too.

Version number (found in Help tab in Settings): in all versions since release.

I think the best method to replicate this issue reliably is to either place objects in the world and enabling the physics property or enabling physics inside an Init function when it’s spawned. Both entities have enabled physics. It also seems like physics cause a lot of recursion errors in the console, when something with physics enters a trigger area with an OnTriggerEnter/-Exit function. This recursion errors also happen on player ragdolls and OnCollision objects. This makes debugging errors really difficult in physics based games.

Ah, i found a video that i captured back in july when i mentioned it the first time on discord:

The first two previews only spawn one car (or maybe two inside eachother) and the last preview spawns two cars. I also found another video where i tried to spawn the cars via lua and it lead to the same result.

Another similar bug happens when i (instead of enabling physics) detach an entity inside the Init function. It duplicates entities too.

Ah, remembered how to fix it:
Wait a frame by adding a schedule into the Init function before enabling physics/detaching via code.

Hi Ya_shi_shi,

Thank you for the detailed bug report!
I’ve created and submitted a ticket regarding the duplication bug you’ve encountered to our internal team for further investigation.