Hi everyone, this is my problem I’ve had with Unity, that I can’t quite figure out…
I’m building levels from room prefabs placed “randomly” (at the moment I’m just spitting them out via a defined plan in code).
When the player passes through an area trigger the game loads the a level asynchronously which contains a gameobject with the room prefabs in it. The level is then instantiated according to the plan generated above.
It has all been working beautifully up until thisafternoon when I’ve added enemy instantiations.
After enemy instantiations were added to the game, the floor gameobject and up to two wall gameobject children’s MeshRenderers of the first room prefabs seemingly teleport to the origin. The other rooms, which are instantiated from exactly the same prefabs are fine. The first room doesn’t even have the enemies in it.
I’ve spent two hours eliminating what’s occuring when parts of the room teleport, and it’s when I’m instantiating parts of each enemy. If I instantiate any part, MeshRenderers of parts of the first room will display locked in the origin.
The actual gameobject that holds the floor and random walls is not teleporting. The position and localPosition of the gameObject doesn’t change, and neither does any of it’s parent objects in the heirarchy…
The first image I’ve attached shows the object with the meshrenderer rendering at the origin.
The second image is a test where I move the game object in the inspector. The collision and everything else move but the meshrender still renders the floor object at the origin!
Commenting out the enemy instantiations “resolves” the issue, but I’ve taken pains to eliminate any links between the enemies spawning and any changes to the level by commenting everything else out, but if I instantiate any part of the enemy (graphics, shadow or brain), the floor will move!
Can someone please explain what might be happening? This is driving me nuts!
Thanks a bundle
Alister

