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
0
Question by Morgan · May 13, 2015 at 10:01 PM · ioskeyboardinputfield

Access to iPhone "Done" button with Unity 4.6 InputField?

"TouchScreenKeyboard.done" works if you open a keyboard independently of an Input Field, but what about the keyboard that comes up for an InputField? Is it possible to tell when that "Done" button has been used?

There doesn't seem to be a property of InputField to address its keyboard (other than KeyboardType); nor does On Submit (Event Trigger) seem to do anything with that button. I'm guessing there must be some way to address the keyboard, and then I'll be all set!

("Cancel" does reset the field text, so that's useful at least. But I wouldn't mind customizing that function as well.)

Comment
Add comment · Show 3
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 Morgan · May 14, 2015 at 07:11 PM 0
Share

If that keyboard is NOT accessible from code, I'm considering a workaround: track whether the InputField loses focus, and assume "Done" has been tapped if so. Which is actually not always true: it loses focus from tapping anything in my UI. But I can set a variable to true when tapping every OTHER button--so if it's false, then by process of eli$$anonymous$$ation, the focus loss must have come from "Done" or "Cancel." (Luckily, for my purposes, I don't think I need to tell those two apart.) Just a thought... kind of hacky though.

avatar image Morgan · May 16, 2015 at 01:29 AM 0
Share

Is it impossible to know the user has tapped Done (or Cancel)?

The following does not work (the condition never happens because it refers to a non-existent keyboard, not the InputField's keyboard):

 private var keyboard : TouchScreen$$anonymous$$eyboard;
 
 function Update () {
     if (keyboard && keyboard.done) {
         editorAccept(); //(The function I want to call)
     }
 }

(Another thing that doesn't work is On End Edit: that triggers whenever the user taps anything in the UI--not just for Done and Cancel.)

FWIW, I'm allowing the white editing box at the top of the keyboard; and newlines are allowed, so Return is not the same as Done.

Thanks for any ideas or leads! It makes the app feel broken when Done doesn't do anything.

(If it can be done in Unity 5, that's fine too—I've bought it and will start using it when it's been out longer.)

avatar image Morgan · May 21, 2015 at 07:19 PM 0
Share

If InputField's own Done and Cancel are not exposed to scripting at all, is there a way to take an indepedently-opened keyboard and attach it to the InputField so it behaves the same as the InputField's own?

I've tried just opening a keyboard with TouchScreen$$anonymous$$eyboard.Open, but its connection to the field is unreliable at best. (No doubt affected by other things I'm doing with the field and UI.) Sometimes text in the field appears above the keyboard, sometimes not; and sometimes typed text gets put in the field, sometimes not.

But if I could make my TouchScreen$$anonymous$$eyboard.Open keyboard attach to the InputField fully, the way the field's own keyboard was, maybe that's a useful approach?

Unfortunately I can't find any documentation of how InputField works on mobile.

0 Replies

· Add your reply
  • Sort: 

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

19 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

Related Questions

No predictive part for french keyboard on iOS ? 0 Answers

password inputfield on iOS- keyboard type 0 Answers

[iOS] Sliding input field/keyboard question 0 Answers

InputField not bringing up the keyboard on IOS 4 Answers

Shouldn't taps on UI.InputField open Keyboard on mobile ? 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