Jump to content

Unity 5.6: OnClick() not working...

I got a problem.

 

Im making a menu for a game in unity 5.6. I am using this tutorial:

 

https://unity3d.com/learn/tutorials/topics/user-interface-ui/creating-main-menu?playlist=17111

 

In this part of the video:

 

 

 

He adds the script, hits a dropdown menu and then goes LoadSceneOnClick > LoadByIndex(int), and then sets "LoadByIndex" to 1. When I hit the dropdown menu, the only option is "MonoScript", and then "Sting name":

 

Unity_2017-04-18_08-11-26.png.79a19f1478cd834b01ca1327218e073c.png

 

Even if I input "1" into the box, nothing happens when I play the scene. Here is my script:

 

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class LoadSceneOnClick : MonoBehaviour {

	public void LoadByIndex(int sceneIndex)
	{
		SceneManager.LoadScene (sceneIndex);
	}
}

 

Using unity 5.6. HOW TO FIX!?!?!? Getting frustrated.

 

 

 

All help appreciated!

 

Since I am to lazy to put something interesting here, I will put everything, but slightly abbreviated. Here is everything:

 

42

 

also, some questions to make you wonder about life:

 

What is I and who is me? Who is you? Which armrest in the movie theatre is yours?

 

also,

 

Welcome to the internet, I will be your guide. Or something.

 

 

My build:

CPU: Intel Core i5-7400 3.0GHz Quad-Core Processor,

 Motherboard: ASRock B250M Pro4 Micro ATX LGA1151 Motherboard, 

Memory: Corsair 8GB (1 x 8GB) DDR4-2133 Memory,

Storage: Seagate Barracuda 1TB 3.5" 7200RPM Internal Hard Drive, 

Video Card: MSI Radeon RX 480 4GB ARMOR OC Video Card, 

Case: Corsair 100R ATX Mid Tower Case , 

Power Supply: Corsair CXM 450W 80+ Bronze Certified Semi-Modular ATX Power Supply, 

Operating System: Microsoft Windows 10 Home Full, 

Wireless Network Adapter: TP-Link TL-WN725N USB 2.0 802.11b/g/n Wi-Fi Adapter, Case Fan: Corsair Air Series White 2 pack 52.2 CFM  120mm Fan

 

ou do not ask why, you ask why not -me

 

Remeber kinds, the only differ between screwing around and scince is writing it down. -Adam Savage.

 

Only two things are infinite: the universe and human stupidity, and I'm not even sure of the former. - Albert Einstein.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×