Jump to content

Unity 5.6: OnClick() not working... Still (Help Please, VERY frustrated)

King_of_Oz
Go to solution Solved by King_of_Oz,
13 hours ago, Minibois said:

Can't watch the video currently so I'm just gonna suggest some things. Is that variable you want to set to 1 a public variable in the guy's script? Have you tried some log code to see if the button works at all?

 

After this I can suggest some more (but sorry, don't expect Swift answers from me)

 

5 hours ago, fpo said:

You are loading a level. 

 

Add the scenes to the build settings. 

File build settings (or build. Not build and run) then select add active scenes and go to every scene and do that. 

Hey! Thanks A BUNCH for your help! I also posted my question on the Unity Answers forum and I found the solution there:

 

https://forum.unity3d.com/threads/unity-5-6-onclick-not-working.468754/#post-3052263

 

 

All I had to do was add the script to a game object, then add that game object to the OnClick().  Thanks for your help anyway, thought, it's always nice to know people got your back.

Hey guys,

 

A while ago I posted the topic above regarding an issue I am having with a game I am developing. I got no responses. I have tried everything possible to fix it (That I can think of), but no result. This is delaying the development process of my game, and I am getting really, REALLY FRUSTRATED!!! PLEASE help! I would be SUPER APPRECIATED!. Here is the topic:

 

 

Quote

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!

 

You can respond to this post or the original one linked below, either on is fine. Also, mods... if reposting the same topic is a against the standards is against stardards, feel free to remove this topic. (Thought I read the community standards and I'm pretty sure it's not...)

 

 

ALL HELP INSANELY 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

Can't watch the video currently so I'm just gonna suggest some things. Is that variable you want to set to 1 a public variable in the guy's script? Have you tried some log code to see if the button works at all?

 

After this I can suggest some more (but sorry, don't expect Swift answers from me)

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, Minibois said:

Can't watch the video currently so I'm just gonna suggest some things. Is that variable you want to set to 1 a public variable in the guy's script? Have you tried some log code to see if the button works at all?

 

After this I can suggest some more (but sorry, don't expect Swift answers from me)

OMG THAAAAAAAAANKS!!!!!!! I will try your suggestions, and get back to you on the results! I have no problem waiting for responses, as long as I get the problem fixed! (And yes, the variable is set to 1.)

 

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

You are loading a level. 

 

Add the scenes to the build settings. 

File build settings (or build. Not build and run) then select add active scenes and go to every scene and do that. 

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, Minibois said:

Can't watch the video currently so I'm just gonna suggest some things. Is that variable you want to set to 1 a public variable in the guy's script? Have you tried some log code to see if the button works at all?

 

After this I can suggest some more (but sorry, don't expect Swift answers from me)

 

5 hours ago, fpo said:

You are loading a level. 

 

Add the scenes to the build settings. 

File build settings (or build. Not build and run) then select add active scenes and go to every scene and do that. 

Hey! Thanks A BUNCH for your help! I also posted my question on the Unity Answers forum and I found the solution there:

 

https://forum.unity3d.com/threads/unity-5-6-onclick-not-working.468754/#post-3052263

 

 

All I had to do was add the script to a game object, then add that game object to the OnClick().  Thanks for your help anyway, thought, it's always nice to know people got your back.

 

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

×