/// <summary> /// Gets a blend variable controller for a specific variable, allowing you to edit that variable /// much faster than by SetBlendVar(name, value). /// </summary> /// <param name="blendVar">blendVar you want to controll</param> public BlendVarController GetBlendControllerFor(string blendVar) { BlendVarController controller = new BlendVarController(blendVar); foreach (var animationLayer in layers) { animationLayer.AddTreesMatchingBlendVar(controller, blendVar); } if (controller.InnerControllerCount == 0) { if (!hasAwoken) { Debug.LogError("Trying to create a blend controller in an AnimationPlayer before it has called Awake!. Please either move your calls " + "to Start or later, or use script execution order to make sure you're called after AnimationPlayer!"); } else { Debug.LogWarning($"Warning! Creating a blend controller for {blendVar} on AnimationPlayer on {name}, " + $"but there's no blend trees that cares about that variable!", gameObject); } } return(controller); }
public void AddTreesMatchingBlendVar(BlendVarController aggregateController, string blendVar) { List <BlendTreeController1D> blendControllers1D; if (varTo1DBlendControllers.TryGetValue(blendVar, out blendControllers1D)) { aggregateController.AddControllers(blendControllers1D); } List <BlendTreeController2D> blendControllers2D; if (varTo2DBlendControllers.TryGetValue(blendVar, out blendControllers2D)) { aggregateController.AddControllers(blendControllers2D); } }