How can I make both hands fingers change by adding another enum mode?

A bit long but this scripts are connected to each other. I will explain the exact things I’m trying to add/change.

This is the controller script :

using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Serialization;      /*      * Asset stores key control config.      */     [ExecuteInEditMode]     [RequireComponent(typeof(Animator))]     public class HandController : MonoBehaviour     {         [SerializeField] private HandPosePresetsAsset m_preset;         [SerializeField] private HandType m_handType = HandType.LeftHand;         [SerializeField] private HandPoseData m_handPoseData;          private HandRuntimeControl m_runtimeControl;         private Avatar m_avatar;          private HandPoseData m_basePose;          public HandType Hand         {             get { return m_handType; }             set             {                 m_handType = value;                 InitializeRuntimeControl();             }         }          public HandPosePresetsAsset Preset         {             get => m_preset;             set => m_preset = value;         }          private void Awake()         {             InitializeRuntimeControl();             #if UNITY_EDITOR                          #endif         }          /// <summary>         /// Set current hand pose as base pose for transformation.          /// </summary>         public void SetCurrentAsBasePose()         {             m_basePose = m_handPoseData;         }                          /// <summary>         /// Set base hand pose from currently assigned preset          /// </summary>         public void SetBasePoseFromCurrentPreset(string poseName)         {             m_basePose = m_preset[poseName];         }                  /// <summary>         /// Set base hand pose from currently assigned preset          /// </summary>         public void SetBasePoseFromCurrentPreset(int index)         {             m_basePose = m_preset[index];         }                          /// <summary>         /// Set base hand pose.         /// </summary>         public void SetBasePose(ref HandPoseData pose)         {             m_basePose = pose;         }                          /// <summary>         /// Set hand pose.           /// </summary>         /// <param name="poseName">name of pose in RuntimeHandPosePresetAsset.</param>         /// <param name="t">lerp value of hand pose. 0.0f=base pose, 1.0f=poseName pose</param>         public void SetHandPose(string poseName, float t = 1.0f)         {             var pose = m_preset[poseName];             SetHandPose(ref pose, t);         }          /// <summary>         /// Set hand pose.           /// </summary>         /// <param name="poseIndex">index of pose in RuntimeHandPosePresetAsset.</param>         /// <param name="t">lerp value of hand pose. 0.0f=base pose, 1.0f=poseName pose</param>         public void SetHandPose(int poseIndex, float t = 1.0f)         {             var pose = m_preset[poseIndex];             SetHandPose(ref pose, t);         }                  /// <summary>         /// Set hand pose.           /// </summary>         /// <param name="data">hand pose</param>         /// <param name="t">lerp value of hand pose. 0.0f=base pose, 1.0f=data</param>         public void SetHandPose(ref HandPoseData data, float t = 1.0f)         {             if (m_runtimeControl == null)             {                 InitializeRuntimeControl();             }             LerpHandPose(ref m_handPoseData, ref m_basePose, ref data, t);         }          private static void LerpHandPose(ref HandPoseData data, ref HandPoseData src, ref HandPoseData dst, float t)         {             switch (t)             {                 case 0f:                     data = src;                     break;                 case 1.0f:                     data = dst;                     break;                 default:                 {                     for (var i = 0; i < HandPoseData.HumanFingerCount; ++i)                     {                         data[i] = new FingerPoseData                         {                             muscle1 = Mathf.Lerp(src[i].muscle1, dst[i].muscle1, t),                             muscle2 = Mathf.Lerp(src[i].muscle2, dst[i].muscle2, t),                             muscle3 = Mathf.Lerp(src[i].muscle3, dst[i].muscle3, t),                             spread = Mathf.Lerp(src[i].spread, dst[i].spread, t)                         };                     }                     break;                 }             }         }          public void InitializeRuntimeControl()         {             var animator = GetComponent<Animator>();             m_avatar = animator.avatar;              if (m_avatar == null)             {                 Debug.LogError("HandController:Animator component doesn't have a valid avatar configured.");             }                          m_runtimeControl = new HandRuntimeControl(gameObject, m_avatar, m_handType);         }          private void LateUpdate()         {             m_runtimeControl?.UpdateHandPose(ref m_handPoseData);         }     } 

The next script is the HandType

In the enum I added the BothHands

using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using UnityEngine;      public enum HandType     {         LeftHand,         RightHand,         BothHands     }      [Serializable]     public struct FingerPoseData     {         [Range(-1f, 1f)]         public float spread;         [Range(-1f, 1f)]         public float muscle1;         [Range(-1f, 1f)]         public float muscle2;         [Range(-1f, 1f)]         public float muscle3;                  public void WeightedAddPose(float weight, ref FingerPoseData data)         {             spread += weight * data.spread;             muscle1 += weight * data.muscle1;             muscle2 += weight * data.muscle2;             muscle3 += weight * data.muscle3;         }     }      [Serializable]     public struct HandPoseData     {         public FingerPoseData thumb;         public FingerPoseData index;         public FingerPoseData middle;         public FingerPoseData ring;         public FingerPoseData little;          public const int HumanFingerCount = 5;                  public FingerPoseData this[int idx]         {             get             {                 if (idx < 0 || idx >= HumanFingerCount)                 {                     throw new IndexOutOfRangeException();                 }                  switch (idx)                 {                     case 0:                         return thumb;                     case 1:                         return index;                     case 2:                         return middle;                     case 3:                         return ring;                     default:                         return little;                 }             }              set             {                 if (idx < 0 || idx >= HumanFingerCount)                 {                     throw new IndexOutOfRangeException();                 }                 switch (idx)                 {                     case 0:                         thumb = value;                         break;                     case 1:                         index = value;                         break;                     case 2:                         middle = value;                         break;                     case 3:                         ring = value;                         break;                     default:                         little = value;                         break;                 }             }         }          public void WeightedAddPose(float weight, ref HandPoseData data)         {             thumb.WeightedAddPose(weight, ref data.thumb);             index.WeightedAddPose(weight, ref data.index);             middle.WeightedAddPose(weight, ref data.middle);             ring.WeightedAddPose(weight, ref data.ring);             little.WeightedAddPose(weight, ref data.little);         }     }      public class HandRuntimeControl     {         private readonly int[] m_handBoneIndexMap;         private readonly HumanPoseHandler m_poseHandler;         private readonly GameObject m_rootObject;         private HumanPose m_humanPose;          public HandRuntimeControl(GameObject rootObject, Avatar avatar, HandType handType)         {             m_rootObject = rootObject;             m_poseHandler = new HumanPoseHandler(avatar, rootObject.transform);             m_handBoneIndexMap = new int[20];              var indexMuscleFingerBegin = handType == HandType.LeftHand ? 55 : 75;                          m_poseHandler.GetHumanPose(ref m_humanPose);              for (var i = 0; i < m_handBoneIndexMap.Length; ++i)             {                 m_handBoneIndexMap[i] = indexMuscleFingerBegin + i;             }         }          public void UpdateHandPose(ref HandPoseData handPose)         {             m_poseHandler.GetHumanPose(ref m_humanPose);                          m_humanPose.bodyPosition = Vector3.zero;             m_humanPose.bodyRotation = Quaternion.identity;                          var i = 0;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.thumb.muscle1;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.thumb.spread;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.thumb.muscle2;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.thumb.muscle3;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.index.muscle1;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.index.spread;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.index.muscle2;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.index.muscle3;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.middle.muscle1;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.middle.spread;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.middle.muscle2;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.middle.muscle3;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.ring.muscle1;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.ring.spread;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.ring.muscle2;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.ring.muscle3;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.little.muscle1;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.little.spread;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.little.muscle2;             m_humanPose.muscles[m_handBoneIndexMap[i++]] = handPose.little.muscle3;                          m_poseHandler.SetHumanPose(ref m_humanPose);         }     } 

The last script :

using System; using System.Collections; using System.Collections.Generic; using UnityEngine;  [RequireComponent(typeof(HandController))] public class InteractiveHandControllerAdapter : MonoBehaviour {     [Serializable]     public struct InputConfig     {         public HandType hand;         public string inputName;         public int presetIndex;     }      [SerializeField] private InputConfig[] m_inputs;      private HandController m_leftHand;     private HandController m_rightHand;          // Start is called before the first frame update     void Start()     {         foreach (var c in GetComponents<HandController>())         {             if (c.Hand == HandType.LeftHand)             {                 m_leftHand = c;             }             else             {                 m_rightHand = c;             }         }     }      // Update is called once per frame     void Update()     {         if (m_inputs != null)         {             foreach (var input in m_inputs)             {                 if(input.hand == HandType.LeftHand)                      m_leftHand?.SetHandPose(input.presetIndex, Input.GetAxis(input.inputName));                 else                      m_rightHand?.SetHandPose(input.presetIndex, Input.GetAxis(input.inputName));             }         }     } } 

Its working fine when I change the enum in the editor or runtime for LeftHand or RightHand :

In the Inspector in this screenshot I selected the Left Hand I can change it to the Right Hand and it will affect the hands find but when changing to Both Hands it does nothing or keep changing only the left hand. I want it to change both hands when it’s on the both hands enum mode.

Hands controller script settings in inspector