﻿using UnityEngine;

namespace Adverty5.Utils
{
    public class ScriptableObjectSingleton<T, W> : ScriptableObject
        where T : ScriptableObject
        where W : ScriptableObjectFactory<T>, new()
    {
        private static T instance;

        public static T Instance
        {
            get {
                if (instance == null)
                {
                    instance = new W().Create();
                }

                return instance;
            }
        }
    }
}
