Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
2
Question by shivpkumar · Feb 14, 2018 at 09:46 PM · vrkeyboardinputfield

How can I stop InputField focus/selection from activating device's native keyboard?

I'm developing a Daydream application that uses the GVR keyboard for text input. I'd also really like to use Unity's native InputField so that I can take advantage of its many features, such as caret blinking. The problem is that InputField by default will always try to open the device's native keyboard when the input field is selected/activated/focused. That means that in VR, the 2D keyboard pops up on screen anytime an InputField is selected, which is a total blocker.

I've tried creating my own sub-class of InputField, but the best I could do was immediately hide the device-native keyboard after it was activated. This would result in an undesirable flicker on the screen. Here's what that code looked like, for reference:

 using UnityEngine.EventSystems;
 using UnityEngine.UI;
 
 public class DaydreamInputField : InputField {
 
     protected override void LateUpdate() {
         base.LateUpdate();
 
         if (m_Keyboard != null && m_Keyboard.active) {
             m_Keyboard.active = false;
         }
     }
 }

What I really need is a way to either tell the InputField to not open the keyboard or a way to set TouchScreenKeyboard.isSupported to false (or something along those lines). Here are the lines of code I'm looking at:

   if (TouchScreenKeyboard.isSupported)
   {
     if (Input.touchSupported)
     {
       TouchScreenKeyboard.hideInput = shouldHideMobileInput;
     }
     
     m_Keyboard = (inputType == InputType.Password) ?
       TouchScreenKeyboard.Open(m_Text, keyboardType, false, multiLine, true) :
       TouchScreenKeyboard.Open(m_Text, keyboardType, inputType == InputType.AutoCorrect, multiLine);
     }
   else
   {
     Input.imeCompositionMode = IMECompositionMode.On;
     OnFocus();
   }

If that first if block was just useKeyboard && TouchScreenKeyboard.isSupported (or something like that) and useKeyboard was a public setter, that would be awesome!

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 PanayotCankov · Oct 04, 2018 at 01:52 PM 0
Share

I have similar problem,

Oculus GO keeps displaying a text field at the very bottom of my game when I focus one of the Text$$anonymous$$eshPro Input (it still does the same with the Unity default InputField).

Often in VR we will have virtual keyboards and will need to reuse the exiting text components for text selection, carrets etc. but suppress them from opening the native keyboards.

:( +1

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Feb 15, 2018 at 04:15 AM

I barely used the new UI system. However it looks like the Input field actually has a setting to disable the mobile input:

shouldHideMobileInput

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 shivpkumar · Feb 15, 2018 at 06:50 AM 0
Share

This is meant to hide the input that sits on top of the native keyboard. I'm trying to hide the ENTIRE keyboard. Thanks for the reply, though!

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

156 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

InputField keyboard hide suggestion 0 Answers

Keyboard not opening when I am trying to shift to next input field through script 0 Answers

Input keys not working ! please help me,Can't use input keys ! please help me ! 0 Answers

Handling Multiple U.I. Input Fields 0 Answers

Is there a way for inputfields to follow keyboard when i select them ? 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