public SiteManager (GameObject siteManagerObj, string indexUrl) { this.siteManagerObj = siteManagerObj; this.cont = siteManagerObj.GetComponent<BootViewController>() as BootViewController; this.basePath = indexUrl.Replace(UnidonSettings.BOOT_HTML_NAME, string.Empty); this.targetAssetPathBase = Path.Combine(basePath, "AssetBundles"); Caching.CleanCache(); sManager = this; }
/* this method will running between Awake and Start. */ [RuntimeInitializeOnLoadMethod] static void OnRuntimeMethodLoad () { var dataPath = Application.dataPath; var url = string.Empty; // set url for resources. if (string.IsNullOrEmpty(Application.absoluteURL)) { var localAssetPathBase = Directory.GetParent(dataPath).ToString(); var localAssetPath = Path.Combine(localAssetPathBase, "UnidonWeb/" + UnidonSettings.BOOT_HTML_NAME); url = "file://" + localAssetPath; } else { url = Application.absoluteURL; } if (url.StartsWith("file://")) { Debug.Log("running in local. attaching websocket debugguer. browser's log window is suck."); // var webSocketConsole = new WebSocketConsole(); // Application.logMessageReceived += webSocketConsole.SendLog; } else { Debug.Log("running in production."); } var usingMemory = Profiler.GetTotalAllocatedMemory(); var reservedMemory = Profiler.GetTotalReservedMemory(); Debug.Log("load done, show everything. url:" + url + " dataPath:" + dataPath + " usingMemory:" + usingMemory + " reservedMemory:" + reservedMemory); // url:file:///Users/tomggg/Desktop/UniCMS/UniCMSWeb/index.html // dataPath:file:///Users/tomggg/Desktop/UniCMS/UniCMSWeb // usingMemory: 1,143,025 // reservedMemory: 1,585,093 // use this for debugging, editing. if (SceneManager.GetActiveScene().name != "Boot") { Debug.LogError("this is not Boot scene, current scene is:" + SceneManager.GetActiveScene().name); return; } // loaded from Boot scene. start loading index scene. var siteManagerObj = GameObject.Find("SiteManagerObject"); DontDestroyOnLoad(siteManagerObj); siteManager = new SiteManager(siteManagerObj, url); Debug.Log("urlによって呼び出すものを変えればいい。index.htmlからきてるなら、index。それ以外ならそれ以外のコンテンツを読み出す。 url:" + url); siteManager.LoadIndexView(); }