29 lines
627 B
C#
29 lines
627 B
C#
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<T> 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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|