19 lines
328 B
C#
19 lines
328 B
C#
using UnityEngine;
|
|
|
|
public class GlobalObject : MonoBehaviour
|
|
{
|
|
private static GlobalObject _instance;
|
|
void Awake()
|
|
{
|
|
if (_instance == null)
|
|
{
|
|
_instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|