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 bobmeyers · Jan 13, 2015 at 06:42 PM · buttonevent4.6submit

4.6 UI: How to invoke button click on Enter key

My mobile app starts with a simple login screen. Users should be able to:

  1. Type in username and password

  2. Tap Enter/Return on the on-screen keyboard to submit

They should not have to tap the actual button on the screen.

I've been poring over the documentation for EventSystem, Selectable, Button, InputField, etc. for hours now, and I still can't figure out how all this is supposed to work.

Obviously, I could just hard-code listening for the Enter key in some script and then invoke the action I want, but that seems like a hack when there's stuff like StandaloneInputModule.submitButton, ISubmitHandler, and Button.OnSubmit lying around.

This scenario is so easy to set up in most UI frameworks, I figure I must be missing something.

What's the right way to do this?

Comment
Add comment · Show 1
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 TechSupportIncoming1 · Jul 27, 2015 at 06:57 PM 0
Share

I have been poking around for this, please somebody guide us the right way on how to use the uGUI (the new EventSystem) equivalent of the old GUI OnButtonDown, OnButtonUp etc...

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by SirAstral · Jul 27, 2015 at 08:48 PM

If I understand you correctly then you are looking for the End Edit eventhandler for the password textbox. It is exposed in the inspector so all you need to do when editing is select the password textbox in the hierarchy, and scroll down in the inspector, then expand the input field (script) to see them.

You can hit the + key on End Edit, then you will need to add a script or object that will handle the logic for verifying the username password for example, and then you will need to set the "No Function" dropdown to the name of the method you want it to execute when done. Pay mind that the method on that object or script must be public or you will not be able to select the fuction that performs the login.

For anyone wondering, On Value Change executed the attached method every time you add or remove a letter from the textbox while you are typing. The End Edit is called when you leave the text box by clicking outside of it or enter and even tabbing if you have that wired up.

Comment
Add comment · 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
0

Answer by moriggi · Jul 28, 2015 at 04:38 AM

hello create the text field name the password and a button inside a canvas Unity 4.6 at least. add an event handler in the button, drag and drop the gameobject containing the script that run the logic from the hierarchy into the add event, select the function in the handler event of the button.

Comment
Add comment · 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

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

28 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

Related Questions

How can a button be highlighted but not trigger on click event when submit button is pressed? 0 Answers

IPointerClickHandler error 2 Answers

Event system or UI Button ? 0 Answers

4.6 How to get name of button that was clicked? 7 Answers

Get button under mouse 1 Answer


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