MainMenu Script :
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
// Use this for initialization
public string characterToUse;
void Awake() {
DontDestroyOnLoad(gameObject);
}
void Start () {
Destroy(GameObject.FindGameObjectWithTag("Player"));
characterToUse = "None";
}
// Update is called once per frame
void Update () {
//Getfromthe MenuGUI : if CharacterToUse = blablabla, this script loads certain scene and doesnt destroy on next scene;
//Once the other Scene is loaded, make "CharacterToUse" = AlreadyUsing, as such it won't activate another character on load, thanks to the DontDestroyOnLoad
}
}
SceneLoader script(A.K.A the player name getter) :
using UnityEngine;
using System.Collections;
public class SceneCharLoad : MonoBehaviour {
// Use this for initialization
void Start () {
GameObject myLoader = GameObject.Find("TheLoader");
myLoader.GetComponent<MainMenu>();
myLoader.characterToUse.SetActive(true);
}
// Update is called once per frame
void Update () {
}
}
And Yes, i have made a prefab to use the MainMenu script on e.e