static int Replace(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject))) { GameObject arg0 = (GameObject)LuaScriptMgr.GetLuaObject(L, 1); GameObject o = GameObjectPlaceholder.Replace(arg0); LuaScriptMgr.Push(L, o); return(1); } else if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(Transform))) { Transform arg0 = (Transform)LuaScriptMgr.GetLuaObject(L, 1); GameObject o = GameObjectPlaceholder.Replace(arg0); LuaScriptMgr.Push(L, o); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: GameObjectPlaceholder.Replace"); } return(0); }
public static GameObject Replace(GameObject obj) { GameObjectPlaceholder placeholder = obj.GetComponent <GameObjectPlaceholder>(); if (placeholder != null) { bool isActive = NGUITools.GetActive(obj); if (isActive) { placeholder.Replace(); } else { NGUITools.SetActive(obj, true); } NGUITools.SetActive(placeholder.spawnedObj, isActive); return(placeholder.spawnedObj); } return(obj); }