- Home /
I'm trying to add an options button to my game but it's not responding
I'm making a mobile game and I'm trying to add an options button, on the HUD, to allow the player to return to the levels menu, but when i test it on my phone it doesn't respond.
The button on my menu works perfectly but when i try and replicate it in the game it doesn't respond and the gun just ends up firing.
Does anyone have any suggestions as to how this is and how i can sort it out?
Addition: The code is
public void ReturnToLevel(string ReturnToLevel) { SceneManager.LoadScene ("Level"); }
When i add a button to the a menu scene, it works perfectly - the button flashes when pressed and sends me to the appropriate place, but in the game scene it doesn't work and the gun just keeps firing
Any suggestions?
Are you using Input.GetTouch or void On$$anonymous$$ouseDown?
im using this
public void $$anonymous$$enuBtn(string $$anonymous$$enuBtn) { Scene$$anonymous$$anager.LoadScene ($$anonymous$$enuBtn); }
Do you have any suggestions why it's not working?
Where are you calling ReturnToLevel() and $$anonymous$$enuBtn() from?
Try just using
void Start ()
{
Input.simulate$$anonymous$$ouseWithTouches = true;
}
void On$$anonymous$$ouseDown ()
{
Scene$$anonymous$$anager.LoadScene ("Level");
}
Is your script on the UI object? If it is, it should work. You can also use this ins$$anonymous$$d of On$$anonymous$$ouseDown().
Yes, it's on the button.
ive added a debug line and it's not co$$anonymous$$g up at all!
Your answer
Follow this Question
Related Questions
how to make a button work on main menu? 0 Answers
Another GUI question. enable and disable 1 Answer
On button hover, Gui Box shows, on box hover, Gui Box shows 1 Answer
drag and drop into other cells 1 Answer
UI Buttons - affects all 0 Answers