- Home /
New UI: OnClick()
I'm new to the updated UI system. I have a pause button on my screen, and if I click it, then after that my jump button (space bar) causes the game to pause/unpause. I want to be sure the button is only affected by a mouse click. Is there a simple, noobish thing I'm doing wrong here?

Could you post what PressPause does, and possibly the Update method that takes input? It sounds like something else may be calling UI_HUD.PressPause, the Button looks like it is set up correctly.
Hi, looks like when you click on "pause" the button gets the focus, then, when you press space, it does an action on the focused UI element and then pauses again.
I don't know exactly how to fix that: maybe move the focus to another element using AnotherUIElement.Select(). $$anonymous$$aybe making this button non "interactable" will clear the focus: try changing $$anonymous$$yButton.interactable to false, then to true.
Answer by Kiwasi · Dec 19, 2014 at 02:05 AM
Go to your EventSystem game object. The stand alone input module will have a feild called submit. Modify or delete as appropriate.
Thank you and sorry for the incredibly late reply! This is almost fixing it. I changed Submit Button from "Submit" to "Fire1" since for now only the left mouse button should be doing anything to it. It no longer actually pauses. However, there's a lingering half-bug.
After the initial press of the pause button, whether paused or unpaused, the button itself still toggles color as if getting highlighted. Using the keyboard (any key apparently) will turn it on as if highlighted, then moving my mouse turns it off. Any idea what causes this?


Change/modify/remove the horizontal and vertical axis. There is also a setting somewhere about navigation events.
Sorry, site wouldn't let me comment for some reason.
Answer by HauntedHotPocket · Dec 30, 2014 at 06:46 AM
When I remove the entries from the Horizontal and Vertical Axis, it gives me "UnityException: Input Axis is not setup. To change the input settings use: Edit -> Project Settings -> Input. I also can't click on it while this error is repeating every frame.


I also tried setting the navigation events to none, explicit, all did the same thing.
Kinda lost at this point as to what's happening. Are there good tutorials on the new UI you recommend? Maybe I just need to go over those more. Thought I did but obviously I'm missing something. Thanks for all the help so far. I'll mark it answered since it's at least not pausing my game anymore. That was the core problem. This is just a cosmetic 'stain'.
![alt text][1]
PressPause() just toggles timeScale between 1 and 0. [1]: /storage/temp/37824-screen+shot+2014-12-29+at+10.16.04+pm.png
Your answer