26 lines
No EOL
573 B
C#
26 lines
No EOL
573 B
C#
using UnityEngine;
|
|
|
|
namespace _test.Singleton.NormalSingleton
|
|
{
|
|
public class NormalSingleton : MonoBehaviour
|
|
{
|
|
public static NormalSingleton Instance { get; private set; }
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance != null && Instance != this)
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
Instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
}
|
|
|
|
public void SayHello()
|
|
{
|
|
Debug.Log("Hello World from NormalSingleton!");
|
|
}
|
|
}
|
|
} |