it should surprise absolutely nobody that it took approximately three minutes for me to go from using scriptable objects to doing code crimes with them
public abstract class SingletonScriptableObject<T> : ScriptableObject where T : ScriptableObject
{
private static T _instance = null;
public static T Instance
{
get
{
if (_instance) return _instance;
var instances = Resources.FindObjectsOfTypeAll<T>();
if (instances.Length > 0)
{
_instance = instances[0];
}
else
{
Debug.LogError(typeof(T) + "instance not found!");
}
if (instances.Length > 1)
{
Debug.LogError("More than one instance of " + typeof(T) + " found!");
}
return _instance;
}
}
}
just inherit from this and slam jam the created object in your resources folder
