public void Destroy() { saveable.ManualSaveLoad = true; removeData = false; SaveMaster.RemoveListener(saveable); Destroy(this.gameObject); }
/// <summary> /// Removes all save data related to this component. /// This is useful for dynamic saved objects. So they get erased /// from the save file permanently. /// </summary> public void WipeData(SaveGame saveGame) { int componentCount = saveableComponentIDs.Count; for (int i = componentCount - 1; i >= 0; i--) { saveGame.Remove(saveableComponentIDs[i]); } // Ensures it doesn't try to save upon destruction. manualSaveLoad = true; SaveMaster.RemoveListener(this, false); }
private void OnDestroy() { if (!manualSaveLoad) { SaveMaster.RemoveListener(this); } #if UNITY_EDITOR if (!Application.isPlaying) { Lowscope.Tools.ValidateHierarchy.Remove(this); saveIdentificationCache.Remove(saveIdentification); } #endif }