Hello everyone.
I am going through the old Unity Persistence Live Training, where they use Application.loadedLevel. I’m trying to use SceneManagement but the following code gives errors.
The problem is that I can’t call SceneManager from OnGUI(), but I can’t use GUI.Label in Start(). All the examples about using the IMGUI, use the old Application model. Unity - Manual: IMGUI Basics
Thank you,
Brian
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ChangeScene : MonoBehaviour {
void Start()
{
Scene scene = SceneManager.GetActiveScene();
}
void OnGUI()
{
GUI.Label(new Rect(10, 10, 100, 20), scene.name);
}
}