public static GameObject GetGameObject(Resource res, string name) { var prefab = (GameObject)res.GetAsset(name); if (prefab != null) { return(GameObject.Instantiate(prefab)); } return(null); }
static int GetAsset(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Launch.Resource obj = (Launch.Resource)ToLua.CheckObject(L, 1, typeof(Launch.Resource)); string arg0 = ToLua.CheckString(L, 2); UnityEngine.Object o = obj.GetAsset(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }