- Home /
Prefab instantiates with incorrect rotation.
I am spawning hundreds/thousands of items in my world, and when I do they spawn with the exact same (incorrect) rotation.
-Apple (Rotation 0,0,0)
--ChildGraphic (60,0,0)
Rotation Should Be: 60, 0, 0 for the Prefab's child.
When I put these in my scene, it's fine. Loads exactly right. When I load just a small part of the world, it's also fine. However when I load the entire world, every single Apple suddenly loads with the wrong rotation.
-Apple (Rotation 0,0,0)
--ChildGraphic (29.99999, 180, 180)
None of my code is changing the rotation. In fact, this exact same code can spawn these correctly if I make the world only spawn a few. It's only when I spawn an enormous number that this bug happens.
So why is this happening? No code EVER touches the rotation. I have tried not parenting the prefab & that makes no difference. (Same bug regardless if the prefab has a parent or not.) I have tried to zero out all localPosition, etc.
It's hard to say what is happening without seeing the script used to spawn them in but the fact that the rotation value is consistently half what it should be is obviously significant. Sounds like something is being flipped.
It probably would be best if you set the rotation of the instantiated objects to the desired value rather than relying on your prefab having that value already.