mirror of
https://github.com/DCFApixels/DragonECS-AutoInjections.git
synced 2025-09-17 20:34:34 +08:00
28 lines
720 B
C#
28 lines
720 B
C#
#if DISABLE_DEBUG
|
|
#undef DEBUG
|
|
#endif
|
|
using System;
|
|
using System.Reflection;
|
|
|
|
namespace DCFApixels.DragonECS
|
|
{
|
|
#if UNITY_2020_3_OR_NEWER
|
|
[UnityEngine.Scripting.Preserve]
|
|
#endif
|
|
internal static class DummyInstance<T>
|
|
{
|
|
#if UNITY_2020_3_OR_NEWER
|
|
[UnityEngine.Scripting.Preserve]
|
|
#endif
|
|
public static T intsance = (T)Activator.CreateInstance(typeof(T));
|
|
}
|
|
internal static class DummyInstance
|
|
{
|
|
private static Type _dummyInstance = typeof(DummyInstance<>);
|
|
public static object GetInstance(Type type)
|
|
{
|
|
return _dummyInstance.MakeGenericType(type).GetField("intsance", BindingFlags.Static | BindingFlags.Public).GetValue(null);
|
|
}
|
|
}
|
|
}
|