Messed positions when loading scene from another.

Hi guys, im very frustrated with this. To make it short for you. I have a large game level that i create for practice in level design and so on. I did it a single large scene instead of spliting the level on diferent scenes to avoid tedious load and saving stuff that i i’m leaving it for later in the project. Then after fighting with the issues of having a considerably huge scene, i’m finishing of putting all the IA, All the items, All the triggers stuff, all the lightning, etc.

Then finally after like two month of work in this project i decided to create a “main menu” to give it a try and maybe share what i have with friends and trusted ppl and ask them for feedback. I have done this before so i didn’t care too much about that at the early steps of the project.

The thing is that when i click “start” and load the scene where the game actually ocurr. After it loads many things are not where they suppouse to be, and this is not happening when i click play from the game scene itself on editor. So this is happening only when i load the scene with “SceneManager.LoadScene”. Before going forward let me give some pics.

link text

That is what it look like normally on editor. Now lets see how it looks when i hit play from there it self.

link text

It looks normall everything is in place running pretty nice and well. Now lets see how it looks when i hit play from the main menu in a separate scene with just a camera and UI stuff.

link text

Well as you can i hope see, when i try to load the scene from script its messed up and everything seems to be broken, i have even get some errors before i add some arguments to the code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LevelManager : MonoBehaviour {

	// Use this for initialization
	public void LoadSomeLevel (string levelName) {
		SceneManager.LoadScene(levelName, LoadSceneMode.Single);
	}

	public void QuitGame (){
		Application.Quit ();
	}
}

Thats the code im using to load the scene. I have a button on the UI of the main menu, that when i click as spected, i call the “public void LoadSomeLevel (string levelName)” and from the button i give it the string i want. Then it start loading the scene, but when its done everything is almost broken.

One of the things i was having in mind that could be the problem, is that the level is not optimized yet, so there is a very large collection of unoptimized gameobject with lods. And i mean a very large amount, the half of the buildings maybe, have interiors and and lots of props like barrels, wood boxes, stuff like that. Of course add to that the AI wich are begin triggered by triggers with setactive instead of instantiation or pooling. Add to that the fact that the game is a bit of survival horror, so there is lots of items to pickup.

I made almost a little open world there, full of stuff. So the collections of game object are very large. And maybe there is something messing everything up but after days of searching for this issue i have found nothing. I’m starting to thing that unity doesnt like large collections of hierarchical gameobject. I learned the leason but i dont want to lose two months of work and have to throw this level to the garbaje that easy. Next time of course i will prepare myself to split the level when you dont need that large scenes. But there has to be something im not seeing, something im missing, there has to be a way of fixing this at least to test the game itself once build.

After all this shit i appreciate in advance any kind suggestion or ideas on what could be happening and how to solve it.

Well i have found the problem, and it was very odd and unespected. Its a script called “WorldRecenter” from the “Realistic FPS Prefab” package that im using for this prototype learning game. After putting on false the “Static Batching” flag, i have solve the odd position issue. But the navmesh was still messing up going far away from the terrain. After checkin this script wich is on the camera root and trying the game again it run normally withouth any issue. So the fault was mine for not looking on what assets im using. Well i did it to speed up the project a bit, becouse at the end it is just a practice project to prepare myself to the real one.