Files

23 lines
530 B
C#
Raw Permalink Normal View History

2022-12-14 18:33:44 +02:00
using UnityEngine;
namespace Demonics.Utility
{
2023-07-04 21:32:21 +03:00
public class DontDestroyOnLoad : MonoBehaviour
{
private static DontDestroyOnLoad instance;
void Awake()
{
if (instance != null && instance != this)
{
Destroy(this.gameObject);
return;
}
else
{
2023-08-28 02:38:39 +03:00
this.transform.SetParent(null);
2023-07-04 21:32:21 +03:00
instance = this;
}
DontDestroyOnLoad(this.gameObject);
}
}
2022-12-14 18:33:44 +02:00
}