Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AnimatorController.layers

Switch to Manual
public var layers: AnimatorControllerLayer[];

Description

The layers in the controller.

It's important to note that the AnimatorControllerLayer are returned as a copy. The array should be set back into the property when changed.

#pragma strict
class ControllerModifier {
	var controller: UnityEditor.Animations.AnimatorController;
	public function ModifyLayers(layerIndex: int, newName: String) {
		var layers: UnityEditor.Animations.AnimatorControllerLayer[] = controller.layers;
		layers[layerIndex].name = newName;
		controller.layers = layers;
	}
}