Search Unity

getting problem in triggering UI animation throught UI manager with code....

Discussion in 'Animation' started by abhinavsharma701, Oct 10, 2019.

  1. abhinavsharma701

    abhinavsharma701

    Joined:
    Sep 18, 2019
    Posts:
    5
    there are no errors but the animation is not playing even i tried to debug code everything is working fine but animations are not played don't know why??? pls help guys..


    1. Ui manager Script:-
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class UI_Manager : MonoBehaviour
    6. {
    7.     #region Singelton
    8.     public static UI_Manager instance;
    9.  
    10.     private void Awake()
    11.     {
    12.         instance = this;
    13.     }
    14.     #endregion
    15.  
    16.     [SerializeField] private Main_Menu mainMenu;
    17.     [SerializeField] private Camera dummyCamera;
    18.  
    19.     public void FixedUpdate()
    20.     {
    21.         if(Input.GetKey(KeyCode.Space))
    22.         {
    23.             mainMenu.FadeOut();
    24.             Debug.Log("pressed");
    25.            
    26.         }
    27.     }
    28.  
    29.     public void dummyCameraActivation()
    30.     {
    31.         dummyCamera.gameObject.SetActive(false);
    32.         Debug.Log("done");
    33.     }
    34. }
    35.  
    2. Main Menu Script Code

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Main_Menu : MonoBehaviour
    6. {
    7.     public Animator _mainMenuAnim;
    8.     private void OnFadeOutComplete()
    9.     {
    10.         Debug.LogWarning("FadeOut clip has been ended");
    11.     }
    12.  
    13.     private void OnFadeInComplete()
    14.     {
    15.         Debug.LogWarning("FadeIn clip has been ended");
    16.         UI_Manager.instance.dummyCameraActivation();
    17.     }
    18.  
    19.     public void FadeIn()
    20.     {
    21.         /*_mainMenuAnimation.Stop();
    22.      
    23.         _mainMenuAnimation.Play("MainMenuFadeIn");*/
    24.     }
    25.  
    26.     public void FadeOut()
    27.     {
    28.          UI_Manager.instance.dummyCameraActivation();
    29.         _mainMenuAnim.SetTrigger("FadeOut");
    30.     }
    31.    
    32. }
    33.  

    screenshots are below
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      113.9 KB
      Views:
      391
    • 2.jpg
      2.jpg
      File size:
      91 KB
      Views:
      398
    • 3.jpg
      3.jpg
      File size:
      48.1 KB
      Views:
      384
    • 4.jpg
      4.jpg
      File size:
      31.6 KB
      Views:
      379
    • 5.jpg
      5.jpg
      File size:
      42.2 KB
      Views:
      381