I’m using a 3D avatar made using Blender and it has two animations: the idle animation and another one. I want to trigger the second animation when the value of a slider is below a number, and go back to the idle animation when the value of the slider is above that number.
I have assigned an animator to the avatar, and I have created a trigger to use it in the transition.
I have written this code, but when the program starts, it doesn’t start with the idle animation (although the slider begins with value 100 and decreases over time).
Animator anim;
public Slider barraDiversion;
void Start()
{
anim = GetComponent<Animator>();
}
void Update()
{
if (barraDiversion.value <= 50)
{
anim.SetTrigger("IrAburrido");
}
}