Okay so I made this script To Enter Level2
// Use this for initialization
void OnTriggerEnter(Collider FPSControllerr)
{
if (FPSControllerr.gameObject.tag == "Player")
{
DontDestroyOnLoad(FPSControllerr.gameObject);
Application.LoadLevel("Level2");
}
}
And its somewhat working.
But when I try to go back
// Use this for initialization
void OnTriggerEnter(Collider FPSControllerr)
{
if (FPSControllerr.gameObject.tag == "Player")
{
DontDestroyOnLoad(FPSControllerr.gameObject);
Application.LoadLevel("MainLevel");
}
}
I get 2 FPScontrolers (which is my player) and the game crashes 
Any solutions ?
You can use the SceneManager to move GameObject between scenes.
if (FPSControllerr.gameObject.tag == "Player")
{
Scene sceneToLoad = SceneManager.GetSceneByName("Level2");
SceneManager.LoadScene(sceneToLoad.name, LoadSceneMode.Additive);
SceneManager.MoveGameObjectToScene(FPSControllerr.gameObject, sceneToLoad);
}
I would just have the player’s position set to the door when it loads the new scene. So have it use DontDestroyOnLoad and then just run a function after you change scenes that places your character wherever it needs to be. That would be the simplest way to do it.
Another thing, if your player is still getting duplicated, you could briefly transition to a blank scene with the player object when your game starts, set the player to not destroy and then load the regular scene. That way there isn’t a player game object as part of your scene, only one from a different scene that you never return to
I wrote an article on this particular problem a while back.
DontDestroyOnLoad needs a bit more work.
Don’t use Don’tDestroy, use additiveSceneLoading… this is how… Unity - Moving Objects Between Scenes - YouTube
attach a script to the player to keep it active & delete the don’t destroy from your script above & in player script you only need this :
void Start(){
DontDestroyOnLoad(gameObject);
}
To avoid duplications add this in your code (in Start() for example).
GameObject[] playersControllers = GameObject.FindGameObjectsWithTag ("Player");
if (playersControllers.Length > 1)
Destroy (playersControllers [1]);
DontDestroyOnLoad
Usually I would use something like this script for DontDestroyOnLoad()
private static GameObject Instance;
void Awake()
{
if (Instance == null)
{
Instance == gameObject;
DontDestroyOnLoad(gameObject);
} else
{
Destroy(gameObject);
}
}