Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question I've just made a circle wipe animation and put it on one of my menus and the buttons aren't working

Discussion in 'Animation' started by PanicMedia, Apr 27, 2021.

  1. PanicMedia

    PanicMedia

    Joined:
    Dec 6, 2020
    Posts:
    37
    I made a circle wipe for my game using a tutorial made by brackeys and now when I go to click any of the buttons they don't work like the play button doesn't load the next scene. does anyone have a way of fixing this. here's my code
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.SceneManagement;
    5.  
    6. public class LevelLoader : MonoBehaviour
    7. {
    8.     public Animator transition;
    9.  
    10.     public float transitionTime = 1f;
    11.     // Start is called before the first frame update
    12.    public void levelLoader()
    13.    {
    14.        LoadNextLevel();
    15.    }
    16.  
    17.     // Update is called once per frame
    18.     public void LoadNextLevel()
    19.     {
    20.         StartCoroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
    21.  
    22.     }
    23.  
    24.     IEnumerator LoadLevel(int levelIndex)
    25.     {
    26.         //Play animation
    27.         transition.SetTrigger("Start");
    28.  
    29.         yield return new WaitForSeconds(transitionTime);
    30.  
    31.         //Load scene
    32.         SceneManager.LoadScene(levelIndex);
    33.     }
    34. }
     
  2. CompFreakAlpha

    CompFreakAlpha

    Joined:
    Feb 12, 2018
    Posts:
    3
    I know this is an old post but for anyone reading this, the Graphic Raycaster component on the canvas is blocking this. If it's not needed for the transitions, just remove it.