Animator Set Layer Weight#
Animation / Animator / Animator Set Layer Weight
Description#
Executes the Set Layer Weight method on the Animator component
Parameters#
| Name | Description |
|---|---|
| Layer Index | |
| Weight |
Code#
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Animator Set Layer Weight")]
[Category("Animation/Animator/Set Layer Weight")]
[Description("Executes the Set Layer Weight method on the Animator component")]
[Image(typeof(IconAnimator), ColorTheme.Type.Teal)]
[Keywords("Animation, Clip, Play, Animate")]
[Parameter("Layer Index")]
[Parameter("Weight")]
[Serializable]
public class GenInstructionAnimator_SetLayerWeight_2 : Instruction
{
[SerializeField] private GetGameObject m_Animator = new GetGameObject(
new GenTypeGameObject_Animator()
);
[SerializeField] private GetInteger m_LayerIndex = new GetInteger();
[SerializeField] private GetNumber m_Weight = new GetNumber();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Set Layer Weight");
return $"{this.m_Animator} {method} ({this.m_LayerIndex}, {this.m_Weight})";
}
protected override Awaitable Run(Args args)
{
Animator component = this.m_Animator.Get<Animator>(args);
if (component == null) return Done;
component.SetLayerWeight(
(int) this.m_LayerIndex.Get(args),
(float) this.m_Weight.Get(args)
);
return Done;
}
}
}