初始化
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DontDestroyMgr : Singleton<DontDestroyMgr>
|
||||
{
|
||||
List<GameObject> dontDesObj = new List<GameObject>();
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user