Weird #unity bug:
I have a trigger zone that causes damage to the player when they touch it. Everything works perfectly, except that I get one frame of damaging collision when I load a particular level. This only happens when I load this level from a previous level, not when I run it directly.
Here's what's really weird: when I look at the stack trace, the zone has transform pos: (-0.100000001, 0, -0.5) rot: eulerAngles: (-0, 0, 0) scale: (10, 1, 10), while the colliding player has transform pos: (20, 0.560276091, -20) rot: eulerAngles: (-0, 0, 0) scale: (1, 1, 1). How are these two colliding?
@peterdrake I cant tell for certain without knowing your collider types etc. but it looks like your zone might overlap the origin. Depending on how you are instantiating your player that might be triggering some unexpected physics events.
@wrstscrnnm6 I'm using the third party TopDown Engine to do that, so I don't know exactly how it works. Conversing with the creators on their Discord now...
@peterdrake Yeah, I think that's because it includes all the loading time as the first frame's delta time and that borks a lot of subsystems.
Having an asynchronous loading screen also solves it pretty gracefully.
The resolution: Unity physics are unreliable on FixedUpdate 0. Now I just don't activate the colliders until the second frame and that seems to fix the problem.