// Copyright | Raumgleiter AG | 2019 | All Rights Reserved // Copyright | Pillars of SY (Simon Gloor) | 2019 | All Rights Reserved //*********************************************************************************************************************** //Headers using System.Collections; using System.Collections.Generic; using UnityEngine; //*********************************************************************************************************************** namespace Raumgleiter { [CreateAssetMenu] public class YOUR_CLASSNAME : ScriptableObject { //Singleton Pattern | Doesn't get destroyed upon leaving Scene private static YOUR_CLASSNAME _inst; public static YOUR_CLASSNAME Instance { get { if (!_inst) { YOUR_CLASSNAME[] ExistingInstances = Resources.FindObjectsOfTypeAll(); if (ExistingInstances.Length > 0) { _inst = ExistingInstances[0]; } } if (!_inst) { _inst = ScriptableObject.CreateInstance(); _inst.hideFlags = HideFlags.DontUnloadUnusedAsset; } return _inst; } } public static bool GetHasInstance() { return _inst != null; } //------------------------------------------------------------------------------------------------------------------ //Resources //[Header("Resources")] //Attributes //[Header("Attributes")] //Stats //[Header("Stats")] //protected bool IsSetUp = false; //Getter //Delegates //------------------------------------------------------------------------------------------------------------------ //setup //public void SetUp() //{ // IsSetUp = true; //} //------------------------------------------------------------------------------------------------------------------ //destroy //*********************************************************************************************************************** //refresh //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //events //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //private //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //protected //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //internal //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //public //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //public static //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //getter, setter //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ } }