void Awake() { if (null != sInstance) return; sInstance = this; // keep alive on change scene DontDestroyOnLoad(this.gameObject); // if exist gameobject called "UIRoot". Destory it. // this maybe we add to desing ui temply GameObject gameObjectUIRoot = GameObject.Find("UIRoot"); if (null != gameObjectUIRoot) GameObject.Destroy (gameObjectUIRoot); GameObject uiPageMain = GameObject.Find("UIPageMain"); if (null != uiPageMain) GameObject.Destroy (uiPageMain); mAssetsMgr = AssetsManager.GetInstance (); mUIMgr = UIManager.GetInstance (); // asset manager update path string updatePath = Application.persistentDataPath + "Update"; if (!Directory.Exists(updatePath)) Directory.CreateDirectory(updatePath); mAssetsMgr.AddUpdatePath (updatePath); // ui manager _Load(0, () => { // lua LuaState.loaderDelegate = LuaLoadFunction; luaSvr_GM = new LuaSvr(); luaSelf_GM =(LuaTable)luaSvr_GM.start("Lua/GameManager"); luaUpdate_GM = (LuaFunction)luaSelf_GM["update"]; }); }