添加缺失插件
This commit is contained in:
21
Assets/Asset Usage Finder/Editor/Data/Globals.cs
Normal file
21
Assets/Asset Usage Finder/Editor/Data/Globals.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace AssetUsageFinder {
|
||||
static class Globals<T> where T : class {
|
||||
static T _instance;
|
||||
|
||||
public static void TryInit(Func<T> ctor) {
|
||||
if (_instance != null) return;
|
||||
_instance = ctor.Invoke();
|
||||
}
|
||||
|
||||
public static T Get() => _instance;
|
||||
|
||||
public static T GetOrCreate(Func<T> ctor) {
|
||||
TryInit(ctor);
|
||||
return _instance;
|
||||
}
|
||||
|
||||
public static void Set(T value) => _instance = value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user