private void Start() { /////////////// /// SINGLETON /////////////// if (Instance != null && this != Instance) { // There can be only one Debug.LogError("Destroying WorldController - there can be only one active WorldController in the scene"); Destroy(this); } Instance = this; ////////////////////////////// /// INITIALIZE DICTIONARIES ////////////////////////////// guidGameObjectMap = new Dictionary <string, GameObject>(); spawnedGameObjects = new List <GameObject>(); ////////////////////////////// /// REGISTER CALLBACKS ////////////////////////////// spawnHandler.RegisterPrefabSpawnedCallback(OnPrefabSpawned); // Search the scene for existing GameObjects with UniqueID components. // Add them to the dictionary if they're not already there. // Eventually we may want to replace this with a scene load operation. RegisterExistingUniqueGameObjects(); }
public virtual void OnDisable() { WorldController.UnregisterSaveCallback(Save); }
public virtual void OnEnable() { WorldController.RegisterSaveCallback(Save); }