static int GetPool(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LuaFramework.ObjectPoolManager obj = (LuaFramework.ObjectPoolManager)ToLua.CheckObject <LuaFramework.ObjectPoolManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); LuaFramework.GameObjectPool o = obj.GetPool(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CreatePool(IntPtr L) { try { ToLua.CheckArgsCount(L, 5); LuaFramework.ObjectPoolManager obj = (LuaFramework.ObjectPoolManager)ToLua.CheckObject <LuaFramework.ObjectPoolManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); UnityEngine.GameObject arg3 = (UnityEngine.GameObject)ToLua.CheckObject(L, 5, typeof(UnityEngine.GameObject)); LuaFramework.GameObjectPool o = obj.CreatePool(arg0, arg1, arg2, arg3); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public GameObject Get(string poolName) { GameObject result = null; if (m_GameObjectPools.ContainsKey(poolName)) { GameObjectPool pool = m_GameObjectPools[poolName]; result = pool.NextAvailableObject(); if (result == null) { Debug.LogWarning("No object available in pool. Consider setting fixedSize to false.: " + poolName); } } else { Debug.LogError("Invalid pool name specified: " + poolName); } return(result); }