Hey all, I am having a catastrophic error, can’t seem to fix it, and am at a complete loss of what to do.
Here is what I think my issue stemmed from:
After starting work on the project, I got to the lesson where we add the grass to the background, and I decided to import all the assets that are attached to the course for this section, and I imported all of them into the project.
What has happened:
My levelmanager script has been removed from all of my buttons throughout the game.
What have I tried:
- reattaching the levelmanagerscript, but when I do so, the only function I can choose is Monodevelop -> string name which is not what I want. I am looking for the old LoadLevel bit.
- Using a prefabbed level manger that I found in the prefabs folder. I don’t necessarily remember prefabbing this. I may have, but I wonder if it came from the package import I did.
-borrowed the old levelmanager script from block defender because it should give me the functionality I need. Didn’t work, still just Monodevelop -> string name is available.
-Copied a levelmanager script to a new script name on a new button
What should happen:
I should be able to drop the script into the button, and have it do the LoadLevel string execution.
Please help. Where have I gone wrong! Level manager script to follow:
using UnityEngine;
using System.Collections;
public class LevelManager : MonoBehaviour {
public void LoadLevel(string name){
Debug.Log ("New Level load: " + name);
Application.LoadLevel (name);
}
public void QuitRequest(){
Debug.Log ("Quit requested");
Application.Quit ();
}
public void LoadNextLevel() {
Application.LoadLevel(Application.loadedLevel + 1);
}
}