using System.Collections; using System.Collections.Generic; using UnityEngine; public class DontDestroyMgr : Singleton { List dontDesObj = new List(); public void DontDesOnLoad(GameObject obj) { if(!dontDesObj.Contains(obj)) { Object.DontDestroyOnLoad(obj); dontDesObj.Add(obj); } } public void Clear() { foreach(GameObject obj in dontDesObj) { Object.DestroyImmediate(obj); } dontDesObj.Clear(); } }