summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Utils/Singleton.cs
blob: bdec31d359b67c0ae7c8e1441882ed9b7a0f8baf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using System;

public class Singleton<T> where T : class, new()
{
    private static T _instance;

    public static T Instance
    {
        get
        {
            if (_instance == null)
                _instance = Activator.CreateInstance<T>();
            return _instance;
        }
    }
}