docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AnimationTriggers

    Structure that stores the state of an animation transition on a Selectable.

    Inheritance
    object
    AnimationTriggers
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.UI
    Assembly: UnityEngine.UI.dll
    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);
        }
    }
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)