static public LuaTable Load(string gameObjectName, string luaFilePath) { GameObject gameObject = new GameObject(gameObjectName); luaFilePathDic.Add(gameObject, luaFilePath); LuaBaseBehaviour luaBaseBehaviour = gameObject.AddComponent <LuaBaseBehaviour> (); luaBaseBehaviour.Init(); return(luaBaseBehaviour.scriptEnv); }
static LuaTable Add <T>(string gameObjectName, string luaFilePath) where T : LuaBaseBehaviour { GameObject gameObject = GameObject.Find(gameObjectName); LuaBaseBehaviour.luaFilePathDic.Add(gameObject, luaFilePath); LuaBaseBehaviour luaBaseBehaviour = gameObject.AddComponent <T> (); luaBaseBehaviour.Init(); return(luaBaseBehaviour.scriptEnv); }
static LuaTable LoadDontDestroy <T>(string gameObjectName, string luaFilePath) where T : LuaBaseBehaviour { GameObject gameObject = new GameObject(gameObjectName); GameObject.DontDestroyOnLoad(gameObject); LuaBaseBehaviour.luaFilePathDic.Add(gameObject, luaFilePath); LuaBaseBehaviour luaBaseBehaviour = gameObject.AddComponent <T> (); luaBaseBehaviour.Init(); return(luaBaseBehaviour.scriptEnv); }