Script Problem dosen't seem to work well, need the right script and explanation

posted to: Interactive Buttons

Hello,

I have a scipt problem, it seems outdated, and I'm really new to the script part. Could you give the right script for my project to work well? Thanks

  • Jonathan Gonzalez(jgonzalez) replied

    I assume you mean loading a level? It was updated to this in Unity: https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html

    Essentially what you need to do is add a namespace at the top: 

    using UnityEngine.SceneManagement;

    Then to load the level you'd use:

    SceneManager.LoadScene("MySceneName");

    or 

    SceneManager.LoadScene(0);