- Home /
Question by
ErkanAkin · Oct 14, 2019 at 12:54 PM ·
scenescene-loadingscene-switchingscene loadscene change
SceneManager.LoadScene not working with button
Hi everyone, I'm having problem with changing current scene via a button or with a dropdown. I'm using same method with triggers at level endswhere it works but when using this with buttons new scene is loading but freeze in first frame and do not log any error message. By the way scenes are added to build index. Here is my simplified script, I use LoadGame() method with a button ;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.SceneManagement;
public class LoadGame : MonoBehaviour
{
public void LoadSelectedLevel()
{
SceneManager.LoadScene(2, LoadSceneMode.Single);
}
}
Comment
Answer by ErkanAkin · Oct 14, 2019 at 01:15 PM
I found the problem guys, Time.timeScale stuck at 0. Making Time.timeScale = 1.0f; in any active script in scene solved the problem.