From dcaad8044384bce4f4358522108bf9a2481ee4e0 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Oct 2020 12:44:29 +0800 Subject: *physics --- Assets/Scripts/Utils/Singleton.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Assets/Scripts/Utils/Singleton.cs (limited to 'Assets/Scripts/Utils/Singleton.cs') diff --git a/Assets/Scripts/Utils/Singleton.cs b/Assets/Scripts/Utils/Singleton.cs new file mode 100644 index 00000000..bdec31d3 --- /dev/null +++ b/Assets/Scripts/Utils/Singleton.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using System; + +public class Singleton where T : class, new() +{ + private static T _instance; + + public static T Instance + { + get + { + if (_instance == null) + _instance = Activator.CreateInstance(); + return _instance; + } + } +} \ No newline at end of file -- cgit v1.1-26-g67d0