- Home /
Question by
017Bluefield · Nov 20, 2016 at 10:09 PM ·
unity 5buttonscenescene-loadingscene-change
Using UI.Button to Load Another Scene? (using outdated tutorial video)
Okay, so I'm trying to load a scene by pressing a UI Button, as demonstrated in a tutorial video (linked below). Unfortunately, the method depicted in that video is outdated, so that closes off that path. Plus, the Unity tutorial for the UI Button, while helpful, doesn't really help me get any closer to the answer I'm looking for.
Is there an equivalent of "load scene via button click" for Unity version 5.4.1?
Video in question: https://www.youtube.com/watch?v=VDskZ2Tobhw
A copy of the script used:
using UnityEngine; using System.Collections; public class SceneSelectButton : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public void LoadSceneSelect () { Application.LoadLevel(1); } }
Comment
Answer by Filhanteraren · Nov 20, 2016 at 10:48 PM
SceneManager.LoadScene ("OtherSceneName", LoadSceneMode.Additive);
Use SceneManager:
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.html
Unfortunately, it doesn't work when I script it as such and press the button in testing.