UI Animator
  • Introduction
  • Tutorial
    • Basic Animation
    • Button & Loop Animation
    • Children Animations
    • SFX & Events
    • Organizing
  • Advanced
    • Use in C#
      • Show / Hide
      • Add Listener
Powered by GitBook
On this page
  1. Advanced
  2. Use in C#

Add Listener

This will listen to the show and hide events.

using ZovaStudio.UIAnimator;
using UnityEngine;

public class UIAnimator_DemoScript : MonoBehaviour
{
    public UIAnimator gameOverUI;
    
    void Awake()
    {
        // On Show
        gameOverUI.onShow.AddListener((isInstant)=>{
            if(isInstant){
                Debug.Log("Game Over Show Instant");
            }
        });
        
        // On Show Complete
        gameOverUI.onShowComplete.AddListener((isInstant)=>{
            if(isInstant){
                Debug.Log("Game Over Show Instant Complete");
            }
        });
        
        // On Hide
        gameOverUI.onHide.AddListener((isInstant)=>{
            if(isInstant){
                Debug.Log("Game Over Hide Instant");
            }
        });
        
        // On Hide Complete
        gameOverUI.onHideComplete.AddListener((isInstant)=>{
            if(isInstant){
                Debug.Log("Game Over Hide Instant Complete");
            }
        });
    }
}
PreviousShow / Hide

Last updated 2 months ago