Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by HauntedHotPocket · Dec 18, 2014 at 11:57 PM · ui

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?

alt text

screen shot 2014-12-18 at 3.55.38 pm.png (38.8 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HYPERSAVV · Dec 19, 2014 at 12:29 AM 0
Share

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.

avatar image _dns_ · Dec 19, 2014 at 01:21 AM 0
Share

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.

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

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.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HauntedHotPocket · Dec 29, 2014 at 08:24 AM 0
Share

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?

alt text

alt text

screen shot 2014-12-29 at 12.46.55 am.png (9.1 kB)
screen shot 2014-12-29 at 12.47.02 am.png (39.6 kB)
avatar image Kiwasi · Dec 29, 2014 at 04:36 PM 0
Share

Change/modify/remove the horizontal and vertical axis. There is also a setting somewhere about navigation events.

avatar image HauntedHotPocket · Dec 30, 2014 at 06:47 AM 0
Share

Sorry, site wouldn't let me comment for some reason.

avatar image
0

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.

alt textalt text

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'.


screen shot 2014-12-29 at 10.20.00 pm.png (28.9 kB)
screen shot 2014-12-29 at 10.20.21 pm.png (29.3 kB)
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HauntedHotPocket · Dec 30, 2014 at 06:48 AM 0
Share

![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

screen shot 2014-12-29 at 10.16.04 pm.png (51.3 kB)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

29 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 2D 4.6b UI: Why are instantiated prefab sprites rendering over UI elements? 1 Answer

Set UI Image to render below Gameobject [Resolved] 1 Answer

New UI batching problem 1 Answer

New UI button OnClick() how to "send message" with parameters? 3 Answers

Unity 4.6.1 text error/bug (unreadable text) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges