public GameObject LoadUI(string prefabPath, IElementCenter elementCenter, GameObject parentUI = null) { if (string.IsNullOrEmpty(prefabPath)) { Debug.LogError("prefabPath is null"); return(null); } var go = CreateGameObjectFromPrefab(prefabPath); if (go == null) { Debug.LogError("UI in path:" + prefabPath + " cannot be load."); return(null); } var scanner = go.GetComponent <IElementScanner>(); if (scanner != null) { scanner.Scan(go, elementCenter); } if (parentUI == null) { parentUI = elementCenter.Get(UI_ROOT_ELEMENT_ID) as GameObject; } if (parentUI == null) { Debug.LogError("no rootUI loaded, please load rootUI first."); } else { concreteUIManager.AddChildUI(go, parentUI); } return(go); }