Invoke not being called even though the gameobject isn't being destroyed
Hello everyone!
I'm having a problem invoking loading a scene after an animation has played. The SceneManager.LoadScene(); function never seems to execute, and I can assure you that the game object isn't being destroyed or disabled at any time
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour
{
public Animator CameraAnimation;
public Animator DoorAnimation;
public void Play()
{
CameraAnimation.CrossFade("PlayCameraTransition", 0.05f);
DoorAnimation.enabled = true;
DoorAnimation.Play("MenuDoorOpen");
Invoke("Load", 2);
}
private void Start()
{
DoorAnimation.enabled = false;
}
void Load()
{
SceneManager.LoadScene("Dungeon");
}
}
and P.S. Play() gets called from a button
Answer by SeaPeaMe · May 12, 2019 at 05:34 AM
I dunno why, but for some reason Time.timescale was set to 0 even though there's nothing in the scene setting it to this... strange
Your answer
Follow this Question
Related Questions
garbage collection in between scene changes? 2 Answers
Restarted scene not working properly 0 Answers
Level Selection Menu...Preview Scene 1 Answer
Switching active scene to loaded additive scene does not change camera/render 1 Answer
After reloading the scene twice one script doesn't work. 0 Answers