private IEnumerator LoadRoleObject(string path, Action <RoleObject> loadFinish) { UnityEngine.Object role = null; TLEditorWww roleWww = null; if (!roleAssetsWww.TryGetValue(path, out roleWww)) { roleWww = TLEditorWww.Create(path); roleAssetsWww.Add(path, roleWww); } while (!roleWww.Finished) { yield return(null); } if (!roleAssets.TryGetValue(path, out role)) { role = roleWww.GetCachedAsset() as GameObject; GameManager.ReplaceShader(role, string.Empty); roleAssets.Add(path, role); } if (role == null) { Debug.LogError("Error, Load role Failed: " + path); } else { Role roleConfig = (role as GameObject).GetComponent <Role>(); if (roleConfig == null) { Debug.Log("config==null"); } GameObject roleGo = ModelLoader.CreateRole(roleConfig).gameObject; var performer = roleGo.GetComponent <ActionPerformer>(); RoleObject roleObj = roleGo.GetComponent <RoleObject>(); roleObj.needAnimationButtonGui = false; roleObj.CheckAnimator(); roleObj.enabled = true; //roleWww.Unload(); loadFinish(roleObj); } }