How to change animator controller parameter value via editor script?

I can use code like this to create an animator controller (a file with .controller suffix)

var controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath("Assets/Mecanim/StateMachineTransitions.controller");
controller.AddParameter("FBBIKWeight", AnimatorControllerParameterType.Float);

Then select it in the project window, it looks like this:

This file is not referenced to any Animator, This is also the result I want, that is, the animator controller is just a .controller file.
but I want the value of FBBIKWeight to be 1.0, but, not found a function like “animatorcontroller.parameters[0].value = 1.0f”.
Currently I can only change this value in the window, however I have thousands of files, so,how should I set the parameters in the animator controller to 1?

There is another overload of the AddParameter() method that accepts a AnimatorControllerParameter

Always start with the documentation. :slight_smile:

Very cool, just pre-define the defult value and then add the parameter.
Thank you very much.
Hah, even vscode told me there was 1 overload, I didn’t see it.:smile: