public IEnumerator showTextUi(MainObject mainObject, bool hideOnTouchNothing, System.Action explorerButtonClick) { if (currentManinObject != null && currentManinObject.Equals(mainObject) && currentTextUIGameObject.activeSelf) { if (Debug.isDebugBuild) { Debug.Log("[DisplayTextUiController-showTextUi] show text already!"); } hideTextUi(); yield break; } currentManinObject = mainObject; this.hideOnTouchNothing = hideOnTouchNothing; TextContent textContent = mainObject.texts[mainObject.currentTextIndex]; GameObject uiGameobject = null; string textui = textContent.displayUI; if (loadedPrefab.ContainsKey(textui)) { if (Debug.isDebugBuild) { Debug.Log("[DisplayTextUiController-showTextUi] Got uiGameobject from cache!"); } uiGameobject = loadedPrefab[textui]; } else { if (Debug.isDebugBuild) { Debug.Log("[DisplayTextUiController-showTextUi] Load uiGameobject from assetBundle!"); } GameObject prefab = null; string[] assetBundleMetaData = textui.Split(new string[] { "/" }, System.StringSplitOptions.RemoveEmptyEntries); string commonAssetBundleName = assetBundleMetaData[0]; string assetName = assetBundleMetaData[1]; yield return(AssetBundleHelper.getInstance().LoadAsset <GameObject>(commonAssetBundleName, assetName, prefabLoaded => { prefab = prefabLoaded; })); if (prefab != null) { uiGameobject = (GameObject)GameObject.Instantiate(prefab, mainCanvas.transform, false); loadedPrefab.Add(textui, uiGameobject); } AddEventTriggerToButtons(uiGameobject); } if (uiGameobject != null) { currentTextUIGameObject = uiGameobject; // now we add eventtrigger for explorerButton AddEventTrigeerToExplorerButton(uiGameobject, explorerButtonClick); yield return(loadTextToUi(uiGameobject, textContent)); if (Camera.main.GetComponent <CameraController_1>()) { Camera.main.GetComponent <CameraController_1> ().OnShowUi(); } } }