using System.Collections; using System.Collections.Generic; using UnityEngine; using WebTools.Customizes.Behaviours; public class NpcFaceShapeChanger : MonoBehaviour { [System.Serializable] public struct ShapeStruct { public BlendShapeType blendShapeType; public string blendShapeName; } [SerializeField] private List shapes; [SerializeField] private List targets; private List blends; private void OnEnable() { if (blends == null) { blends = new List(); foreach (Transform target in targets) blends.AddRange(target.GetComponentsInChildren(true)); } foreach(ShapeStruct shape in shapes) foreach (BlendMesh blend in blends) blend.SetBlendShapeWeight(shape.blendShapeType, shape.blendShapeName, 100); } }