diff --git a/Editor/ReactiveObjects/ParameterAssignerPass.cs b/Editor/ReactiveObjects/ParameterAssignerPass.cs index b7afd0bf..5d85b67e 100644 --- a/Editor/ReactiveObjects/ParameterAssignerPass.cs +++ b/Editor/ReactiveObjects/ParameterAssignerPass.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using nadena.dev.ndmf; using UnityEngine; +using UnityEditor.Animations; +using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.ScriptableObjects; namespace nadena.dev.modular_avatar.core.editor @@ -186,6 +188,22 @@ namespace nadena.dev.modular_avatar.core.editor expParams.parameters = expParams.parameters.Concat(newParameters.Values).ToArray(); } + + if (_mamiByParam.Count > 0) + { + // This make sures the parameters are correctly merged into the FX layer. + var mergeAnimator = context.AvatarRootObject.AddComponent(); + mergeAnimator.layerType = VRCAvatarDescriptor.AnimLayerType.FX; + mergeAnimator.deleteAttachedAnimator = false; + mergeAnimator.animator = new AnimatorController + { + parameters = _mamiByParam.Keys.Select(name => new AnimatorControllerParameter + { + name = name, + type = AnimatorControllerParameterType.Float, + }).ToArray(), + }; + } } internal static ControlCondition AssignMenuItemParameter(