- Home /
Scene Loading occasionally breaks Rigid Bodies...
Hello, I've been working on a 2D unity project for IOS for a little while now. Everything seems to be working as intended about 95% of the time, however I've discovered that if I go from one scene to another and back that basically all of the physics related things (rigid body2D, box collider2D) do not work properly. The colliders aren't recognized properly and sometimes seemingly randomly and certain movement which used to be nice and smooth is now choppy and broken...
I'm not sure what code to post because the project has become quite complicated with many different scripts and I cant really narrow the problem down to a piece of code, as the console throws no errors whatsoever when the issue occurs.. The most I've managed to narrow it down to is the physics issues, as when inspecting the broken scene, all of the issues revolve around either a rigidbody2D or a boxcollider2D. I've also managed to get it to where I can replicate it every time by doing a sequence of going from:
scene A to scene B,
scene B to scene C,
scene C to scene A,
Scene A to B,
and then finally B to D (D being the actual game playing scene, where things break).
But I've also found if I Go directly from:
Scene A to C
then C to A,
A to B,
and B to D, it works fine.
I know this is a long shot, but I've been stuck on this for quite a while and I'm not sure where to turn. Maybe if nothing else someone might have some tips for troubleshooting a problem when you're getting no errors in the console from code...?
Thanks in advance!
Answer by blockhead · Jan 03, 2016 at 09:05 AM
Just in case anyone ever has any similiar issues, I'll post the problem I finally discovered..
The issue was simply that at some point, a script on a prefab I was using in a few different locations was changing Time.fixedDeltaTime value for some reason (I put it there, but I don't remember why...) and that was causing all physics based things to go all haywire...
Your answer
Follow this Question
Related Questions
Workarounds for Higher Control When Using Physics2D? 0 Answers
How to check place on empty for placement polygon Rigidbody2d? 0 Answers
Static Colliders in the 2D Engine in Unity 5 1 Answer
(2D) Can't use colliders when I have a kinematic rigidbody? 1 Answer
Location of RigidBody2D on collision 3 Answers