Class AnimationTriggers
Structure that stores the state of an animation transition on a Selectable.
Namespace: UnityEngine.UI
Syntax
[Serializable]
public class AnimationTriggers
Properties
disabledTrigger
Trigger to send to animator when entering disabled state.
Declaration
public string disabledTrigger { get; set; }
Property Value
Type | Description |
---|---|
String |
Examples
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.
public class ExampleClass : MonoBehaviour
{
public Animator buttonAnimator;
public Button button;
void SomeFunction()
{
//Sets the button to the Disabled state (Useful when making tutorials).
buttonAnimator.SetTrigger(button.animationTriggers.disabledTrigger);
}
}
highlightedTrigger
Trigger to send to animator when entering highlighted state.
Declaration
public string highlightedTrigger { get; set; }
Property Value
Type | Description |
---|---|
String |
Examples
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.
public class ExampleClass : MonoBehaviour
{
public Animator buttonAnimator;
public Button button;
void SomeFunction()
{
//Sets the button to the Highlighted state (Useful when making tutorials).
buttonAnimator.SetTrigger(button.animationTriggers.highlightedTrigger);
}
}
normalTrigger
Trigger to send to animator when entering normal state.
Declaration
public string normalTrigger { get; set; }
Property Value
Type | Description |
---|---|
String |
Examples
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.
public class ExampleClass : MonoBehaviour
{
public Animator buttonAnimator;
public Button button;
void SomeFunction()
{
//Sets the button to the Normal state (Useful when making tutorials).
buttonAnimator.SetTrigger(button.animationTriggers.normalTrigger);
}
}
pressedTrigger
Trigger to send to animator when entering pressed state.
Declaration
public string pressedTrigger { get; set; }
Property Value
Type | Description |
---|---|
String |
Examples
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.
public class ExampleClass : MonoBehaviour
{
public Animator buttonAnimator;
public Button button;
void SomeFunction()
{
//Sets the button to the Pressed state (Useful when making tutorials).
buttonAnimator.SetTrigger(button.animationTriggers.pressedTrigger);
}
}
selectedTrigger
Trigger to send to animator when entering selected state.
Declaration
public string selectedTrigger { get; set; }
Property Value
Type | Description |
---|---|
String |
Examples
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.
public class ExampleClass : MonoBehaviour
{
public Animator buttonAnimator;
public Button button;
void SomeFunction()
{
//Sets the button to the Selected state (Useful when making tutorials).
buttonAnimator.SetTrigger(button.animationTriggers.selectedTrigger);
}
}