For some reason, my Start button on the opening start scene won’t work.
It keeps saying this:
I haven’t done anything really special with the LevelManager script… I made it the function Static, but I’ve tried it both ways, and nogo.
Here’s my code:
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
public class LevelManager : MonoBehaviour
{
public static void LoadScene(string name)
{
Debug.Log ("LoadScene called for " + name);
SceneManager.LoadScene (name);
}
public void QuitGame(){
Debug.Log ("QuitGame requested");
SceneManager.LoadScene ("Quit");
}
Are you dragging the script directly into the OnClick() event on the Start bytton?
If so, you need to create a GameObject in the Hierarchy first (name it LevelManager), attach the LevelManager script to that, then drag the LevelManager game object from the hierarchy into the OnClick() event.
After you have done this you should be able to select your public method LoadScene() and enter the level name as the parameter text.