public void Clear() { isBeCached = false; if (m_MainAnimator) { m_MainAnimator.runtimeAnimatorController = orginalAnimatorController; } m_nSkinID = -1; m_SkinObj = null; m_SkinObj_B = null; m_SkinObj_A = null; m_MainAnimator = null; m_AnimatorB = null; m_bipedIKAnimator = null; m_creatureProperty = null; m_ReferencedSkinCtrl = null; m_SkinnedMeshRenderList.Clear(); m_MeshRenderList.Clear(); m_AllRenders.Clear(); m_cameraProperty = null; m_characterController = null; m_entitySkinConfig = null; if (m_playEntityStaticEffect) { m_playEntityStaticEffect.Clear(); } if (m_switchEffectWithHeroDistance) { m_switchEffectWithHeroDistance.Clear(); } m_playEntityStaticEffect = null; m_switchEffectWithHeroDistance = null; m_sidekickEntity = null; m_SkinDataObj = null; foreach (RenderVisibleHelper vis in m_VisibleHelperList) { vis.hostSkin = null; var temp1 = vis; ResNode.DestroyRes(ref temp1); } ResNode.DestroyRes(ref m_bindEffect_A); ResNode.DestroyRes(ref m_bindEffect_B); ResNode.DestroyRes(ref m_bindSound); ResNode.DestroyRes(ref m_overrideController); m_VisibleHelperList.Clear(); ResNode.DestroyRes(ref m_characterShadow); ClearAlpha(); ClearBonesMap(); m_isLoadFinish = false; }
void UpdateRendersFromEntityID(int entityID) { if (TargetType != MaterialOpRunType.EntityID || !TargetMaterial || !bInit) { return; } if (EffectNode.UseTestModel) { m_Renders.Clear(); if (!TestModel) { TestModel = GameObject.CreatePrimitive(PrimitiveType.Sphere); TestModel.name += "-Rep-" + gameObject.name; EffectUtily.SaveTestModel(TestModel); } m_Renders.Add(TestModel.GetComponent <Renderer>()); return; } if (entityID == HostEntityID) { return; } Finish(); m_Renders.Clear(); HostEntityID = entityID; if (HostEntityID > 0) { U3D_Render.EntityView view = EntityFactory.getEntityViewByID(HostEntityID); if (null != view && view.SkinControl != null && view.SkinControl.CurrentSkinInstance != null) { if (!view.SkinControl) { return; } if (null == view.SkinControl.CurrentSkinInstance) { return; } EntitySkinConfig sc = view.SkinControl.CurrentSkinInstance.entitySkinConfig; if (AffectBody) { if (sc && sc.BodyRender) { m_Renders.Add(sc.BodyRender); } } if (AffectLeftWeapon) { if (sc && sc.LeftWeaponRender) { m_Renders.Add(sc.LeftWeaponRender); } } if (AffectRightWeapon) { if (sc && sc.RightWeaponRender) { m_Renders.Add(sc.RightWeaponRender); } } if (AffectWings) { if (sc && sc.chibangguadian) { m_Renders.AddRange(sc.chibangguadian.GetComponentsInChildren <SkinnedMeshRenderer>()); } } if (AffectBackPart) { if (sc && sc.BackBodyRender) { m_Renders.Add(sc.BackBodyRender); } } } } SaveOrginalMaterial(); }
public static bool CheckPrefabAssets(string patch, bool isSkin, bool heroSkin) { GameObject go = AssetDatabase.LoadAssetAtPath <GameObject>(patch); if (!go) { Debug.LogError("资源错误:" + patch + "不是预制体或者是空预制体"); return(false); } bool Reslut = true; //先检查skinnedmeshrender,对于animator来说,如果skinnedmeshrender丢失的话,打包的时候会崩溃 //所以要检查每一个预制体的skinned是否正常 SkinnedMeshRenderer[] allSkinneds = go.GetComponentsInChildren <SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer sk in allSkinneds) { if (!sk.sharedMesh) { Debug.LogError("资源错误:" + patch + "中 " + sk.name + "丢失mesh,请检查资源"); Reslut = false; } else { if (sk.sharedMesh.name.Contains("Missing")) { Debug.LogError("资源错误:" + patch + "中 " + sk.name + "丢失mesh,请检查资源"); Reslut = false; } if (sk.sharedMesh.boneWeights.Length <= 0 || sk.sharedMesh.bindposes.Length <= 0) { Debug.LogError("资源错误:" + patch + "中 " + sk.name + "与FBX文件不匹配,请更新."); Reslut = false; } } } MeshFilter[] allMeshFilter = go.GetComponentsInChildren <MeshFilter>(true); foreach (MeshFilter sk in allMeshFilter) { if (!sk.sharedMesh) { Debug.LogError("资源错误:" + patch + "中 " + sk.name + "丢失mesh,请检查资源"); Reslut = false; } else { if (sk.sharedMesh.name.Contains("Missing")) { Debug.LogError("资源错误:" + patch + "中 " + sk.name + "丢失mesh,请检查资源"); Reslut = false; } } } if (isSkin) { Animator[] anis = go.GetComponents <Animator>(); foreach (Animator ani in anis) { if (!ani.runtimeAnimatorController) { Debug.LogError("资源错误:" + patch + "丢失状态机,请检查资源"); Reslut = false; } else { if (ani.runtimeAnimatorController.name.Contains("Missing")) { Debug.LogError("资源错误:" + patch + "丢失状态机,请检查资源"); Reslut = false; } } if (!ani.avatar) { Debug.LogError("资源错误:" + patch + "丢失Avatar,请检查资源"); Reslut = false; } else { if (ani.avatar.name.Contains("Missing")) { Debug.LogError("资源错误:" + patch + "丢失Avatar,请检查资源"); Reslut = false; } } } if (heroSkin) { EntitySkinConfig skinconfig = go.GetComponentInChildren <EntitySkinConfig>(); if (skinconfig) { if (!skinconfig.BodyRender) { Debug.LogError("资源错误:" + patch + "丢失皮肤配置上的[-身体-]配置为空,请[策划]重新配置"); Reslut = false; } } else { Debug.LogError("资源错误:" + patch + "皮肤配置上没有对应的SkinConfig,请[策划]重新配置"); Reslut = false; } } } return(Reslut); }
public void OnEnable() { Instance = target as EntitySkinConfig; }