/** * When Game is launced... */ public void onGameLaunched() { curStates = States.ON_LAUNCHED; //define the current runtime platform. rtPlat = Application.platform; //We should initialize all necessery things. Core.Initialize(); //Initialize the path on the main thread. string temp = null; temp = DeviceInfo.PersistRootPath; temp = DeviceInfo.StreamingPath; if (rtPlat != RuntimePlatform.OSXEditor && rtPlat != RuntimePlatform.WindowsEditor) { FileUtility.createFolder(DeviceInfo.ConfigDownload); } FileUtility.createFolder(DeviceInfo.ArtPath); temp = string.Empty; #if UNITY_ANDROID && !UNITY_EDITOR Android_QuitGame.Initialize(); #endif pauseTime = DateTime.Now; }
public static Android_QuitGame Initialize() { if (!initialized) { var g = new GameObject("AndroidQuitEventListener"); var gobal = GameObject.FindGameObjectWithTag("Gobal"); if (gobal != null) { g.transform.parent = gobal.transform; } _current = g.AddComponent <Android_QuitGame>(); DontDestroyOnLoad(g); initialized = true; } return(_current); }