public void LoadPrefab(string prefabPath) { if (prefabPath == prefabData.itemPrefabPath && prefabData.itemPrefab != null) { return; } _assetManager = GameApplication.Instance.AssetManager; prefabData.itemPrefabPath = prefabPath; prefabData.itemPrefab = _assetManager.GetResource <GameObject> (prefabPath); if (prefabData.itemPrefab == null) { CoreLogger.LogError("GenericViewList", "LoadPrefab cannot find prefab " + prefabData.itemPrefabPath); } }
void InsertImage(string prefabPath) { GameObject imgPrefab = _assetManager.GetResource <GameObject> (prefabPath); if (imgPrefab != null) { for (int i = imageContainer.transform.childCount - 1; i >= 0; i--) { Destroy(imageContainer.transform.GetChild(i).gameObject); } GameObject imgGo = Instantiate(imgPrefab) as GameObject; imgGo.transform.SetParent(imageContainer.transform, false); imageContainer.SetActive(true); } else { CoreLogger.LogWarning("UGuiGeneralDialogController", "InsertImage prefab" + prefabPath + " not found"); imageContainer.SetActive(false); } imageContainer.SetActive(true); }
AppModalView CreateView() { AppModalView ret = null; GameObject modalGo = null; if (IsUsingExistingGameObject) { modalGo = prefab.gameObject; originParent = prefab.transform.parent.gameObject; } else { prefab = _assetManager.GetResource <GameObject> (prefabPath, true); if (prefab == null) { logger.LogError("AppModalHandle", "Open prefab " + prefabPath + " not found"); CloseCompleteEvent(this); return(ret); } modalGo = GameObject.Instantiate(prefab) as GameObject; } modalGo.transform.SetParent(Parent.transform, false); ret = modalGo.GetComponent <AppModalView>(); if (ret == null) { logger.LogError("AppModalHandle", "Open " + modalGo.name + " does not contain AppModalBase component"); GameObject.Destroy(modalGo); CloseCompleteEvent(this); return(ret); } return(ret); }