Question by
LauraLeonard · May 31, 2016 at 04:25 PM ·
buttononclicklevel load
Roll A Ball Obstacle course Question
I followed a tutorial at: https://www.mvcode.co/lessons/roll-a-ball-obstacle-course
I am at course 5 and I can not get the restart button to work.
I have changed this code:
Application.LoadLevel ("MainScene"); //obselete code!
to: SceneManager.LoadScene ("MainScene");
and in the script levelReset.cs I have changed:
using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.SceneManagement;
public class LevelReset : MonoBehaviour , IPointerClickHandler {
public void OnPointerClick (PointerEventData data) {
// reload the scene
//Application.LoadLevelAsync(Application.loadedLevelName);//obselete
UnityEngine.SceneManagement.SceneManager.LoadScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex);
}
}
Any ideas? has anyone else followed this tutorial? Its a great tutorial until the end!
Comment