您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

28 行
652 B

using UnityEngine.SceneManagement;
namespace UnityEngine.Experimental.Rendering
{
[ExecuteInEditMode]
public abstract class Singleton<T> : ScriptableObject where T : ScriptableObject
{
private static T theInstance { get; set; }
protected static T instance
{
get
{
LoadAsset();
return theInstance;
}
}
static void LoadAsset()
{
if (!theInstance)
{
theInstance = CreateInstance<T>();
theInstance.hideFlags = HideFlags.HideAndDontSave;
}
}
}
}