Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetBool

Sets the value of the given boolean parameter.
Read time 1 minuteLast updated 6 days ago

Definition

SetBool(string, bool)

Sets the value of the given boolean parameter.
public void SetBool(string name, bool value)

Parameters

name

The parameter name.

value

The new parameter value.

Remarks

Use AnimatorControllerPlayable.SetBool to pass Boolean values to an Animator Controller via script.
Use this to trigger transitions between states. For example, triggering a death animation by setting an “alive” boolean to false. See documentation on Animation for more information on setting up Animators.
Note: You can identify the parameter by name or by ID number, but the name or ID number must be the same as the parameter you want to change in the AnimatorController.

SetBool(int, bool)

Sets the value of the given boolean parameter.
public void SetBool(int id, bool value)

Parameters

id

The parameter ID.

value

The new parameter value.

Remarks

Use AnimatorControllerPlayable.SetBool to pass Boolean values to an Animator Controller via script.
Use this to trigger transitions between states. For example, triggering a death animation by setting an “alive” boolean to false. See documentation on Animation for more information on setting up Animators.
Note: You can identify the parameter by name or by ID number, but the name or ID number must be the same as the parameter you want to change in the AnimatorController.