using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Assets.Scenes.Ride.Scripts { public abstract class Singleton where T : class, new() { private static T instance = null; private static readonly object locker = new object(); public static T Instance { get { lock (locker) { if (instance == null) instance = new T(); return instance; } } } } }