public AnimatorControllerLayer[] layers ;

描述

控制器中的层。

必须注意,AnimatorControllerLayer 作为副本返回。当发生更改时,应将数组重新设置为该属性。

class ControllerModifier
{
    UnityEditor.Animations.AnimatorController controller;

public void ModifyLayers(int layerIndex, string newName) { UnityEditor.Animations.AnimatorControllerLayer[] layers = controller.layers; layers[layerIndex].name = newName; controller.layers = layers; } }