You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Main = using "Main"
local WaitForSeconds = using "UnityEngine.WaitForSeconds"
local UnityCoroutine = Main.UnityCoroutine
function SetTimeout(func, sec)
UnityCoroutine(WaitForSeconds(sec), coroutine.wrap(func))
end
3、How to dynamically create generic C# object? (如何创建泛型对象 luainterface 版)
local BetterListType = Type.GetType("BetterList`1")
local Vector3Type = Type.GetType("UnityEngine.Vector3, UnityEngine")
local Array = using "System.Array"
local TypeArray = Array.CreateInstance(Type.GetType("System.Type"), 1)
TypeArray:SetValue(Vector3Type, 0)
local makeObj = BetterListType.MakeGenericType(BetterListType, TypeArray)
local Activator = using "System.Activator"
local o = Activator.CreateInstance(makeObj)
print("BetterList: %s", o)