26 lines
566 B
C#
26 lines
566 B
C#
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();
|
||
|
|
}
|
||
|
|
}
|