You've already forked Darklings-FightingGame
mirror of
https://github.com/izzy2lost/Darklings-FightingGame.git
synced 2026-03-10 11:35:19 -07:00
23 lines
530 B
C#
23 lines
530 B
C#
using UnityEngine;
|
|
|
|
namespace Demonics.Utility
|
|
{
|
|
public class DontDestroyOnLoad : MonoBehaviour
|
|
{
|
|
private static DontDestroyOnLoad instance;
|
|
void Awake()
|
|
{
|
|
if (instance != null && instance != this)
|
|
{
|
|
Destroy(this.gameObject);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
this.transform.SetParent(null);
|
|
instance = this;
|
|
}
|
|
DontDestroyOnLoad(this.gameObject);
|
|
}
|
|
}
|
|
} |