Level Manager Script not appearing after being dropped on button

Hey Everyone,
So I am going to preface this by saying that I am using Unity 5.

I created a very simple script to just print to console when the button is pressed.

public class LevelManagerScript : MonoBehaviour {
 	public void LoadLevel(string name) {
 		print("Level Load Requested for: " + name);

I then drag the script from the asset bar over to the buttons On Click ( ) dialogue. In the video it shows several scripts that should already be there. On my IDE however it only shows MonoSpace as an option with “string name” being the only accessible method.

Why is this happening? Why can’t I access the method from my script. Half the time after dragging the LevelManager Script over to the onclick the IDE defaults it to “Game” and displays the same options…

I’ve tried googling it but couldn’t find anything directly related to this problem.

Thanks in advance.

Hi @JMCrooks,

  • Create yourself an empty game object in your scene
  • Rename it to LevelManager
  • Attach your script
  • Drag the LevelManager game object to your Assets folder to create a prefab
  • Drag the LevelManager prefab instance from the Hierarchy to your OnClick event on the button

Hope this helps :slight_smile:


I had an issue with this and I’m not completely sure I have the solution - but have you tried pulling the level manager from the Hierarchy as opposed to the Project section? That worked for me, although there’s probably more to it then that…

Privacy & Terms