So I’ve been creating transition animations between scenes such as when opening and closing my main menu from the classic start menu. A black image’s alpha is raised and lowered creating a fade-out effect, so the process is labelled “Fade_Out”. At the present time pressing the “Start Game” button executes the “OpenMenu” variable and immediately switches scenes. How would I go about making the animation play the press of “Start Game” but then transition to the next scene upon it being black?
Here’s the code I’d like to do it with.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class TitleScreen : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
//create variables for UI options
public void OpenMenu()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
public void CloseMenu()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 0);
}
public void ExitGame()
{
Application.Quit();
Debug.Log("Game has Quit");
}
}
Any and all help would be extremely helpful.