You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mapbox-sdk/Unity/Utilities/SingletonScriptableObject.cs

21 lines
390 B

1 year ago
namespace Mapbox.Unity.Utilities
{
using System.Linq;
using UnityEngine;
public abstract class SingletonScriptableObject<T> : ScriptableObject where T : ScriptableObject
{
static T _instance = null;
public static T Instance
{
get
{
if (!_instance)
{
_instance = Resources.FindObjectsOfTypeAll<T>().FirstOrDefault();
}
return _instance;
}
}
}
}