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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
10
Question by mubeeniqbal · Aug 24, 2014 at 04:20 AM · 4.6

New UI system. How to focus on input fields.

I'm checking out the new unity 4.6.0b17. It's very similar to NGUI to use.

I'm using input fields and can't figure out how to focus on a targeted input field if I click on some label anywhere on the screen which is meant to focus the targeted input field on click. I can't seem to find any such method in the method drop down list for input fields (I'm using the event trigger component).

Any help would be appreciated. Thanks in advance.

Comment
Add comment · Show 4
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 porglezomp · Aug 25, 2014 at 03:53 PM 0
Share

I also need this, anyone have any idea?

avatar image meat5000 ♦ · Aug 25, 2014 at 03:55 PM 0
Share

As 4.6 is currently Beta, the chances of getting a good answer on this are $$anonymous$$imal. It can be hard to tell intended functionality vs bugs.

avatar image porglezomp · Aug 25, 2014 at 04:26 PM 0
Share

You can get it to visually focus by calling its OnPointerClick() method, but it doesn't appear to begin editing.

avatar image giano574 · Oct 03, 2014 at 02:33 PM 0
Share

Did you figure it out? I am looking for an answer as well.

5 Replies

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

Answer by Tryz · Dec 17, 2014 at 04:06 PM

You also may need to activate it for the cursor to show up:

 lInputField.Select();
 lInputField.ActivateInputField();

Comment
Add comment · Show 2 · 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 tahaali54 · Nov 05, 2017 at 03:51 PM 0
Share

I just logged in to upvote your post. This was the simple answer that was required and I read all sorts of complex suggestion everywhere else.

avatar image calurin · Feb 29, 2020 at 12:43 AM 1
Share

The perfect and simple solution that still works years later!

avatar image
13

Answer by pritambarhate · Dec 14, 2014 at 08:56 AM

After spending about an hour on this, for me, following seems to work:

 nameField.Select();
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 AgentFire · Oct 18, 2015 at 07:50 AM 0
Share

Doesn't work until you activate it.

avatar image
9

Answer by Mr-Slat · May 30, 2015 at 04:30 PM

be careful not to use Select() or ActivateInputField() inside awake methods.... if so change them to Start.

Comment
Add comment · Show 2 · 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 Vampsz · Feb 05, 2019 at 07:11 PM 0
Share

thanks for this, couldn't figure out why it failed

avatar image paladim · Oct 12, 2021 at 12:09 PM 1
Share

inside OnEnabled not working too

avatar image
1

Answer by Kaz_Yamof · Nov 15, 2014 at 02:19 AM

Hi guys!

I was looking for that too, and I made this to get the visual focus and start typing on Unity 4.6b20:

 EventSystem.current.SetSelectedGameObject(myInputField.gameObject, null);
 myInputField.OnPointerClick(new PointerEventData(EventSystem.current));

I passed null to the BaseEventData parameter on SetSelectedGameObject, and I called the OnPointerClick by sending a new PointerEventData of the current event system.

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
-2

Answer by Hassanshin · Jul 09, 2019 at 09:09 AM

NEVER DO THIS

 Input.Field.gameobject.setActive(false);

try to disable the Image component, or change the alpha to 0

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

15 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

Related Questions

4.6 GUI, setting default button for joystick? 0 Answers

unity3d 4.6 separate ui for each camera 2 Answers

4.6 - What is InputField's type "AutoCorrect"? 1 Answer

Change Unity 4.6 UI Image element's sprite via script? 2 Answers

4.6 play animation on game over 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