Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 nemoryoliver · May 22, 2013 at 02:22 AM · touchkeyboardngui

HELP Move Screen Up when TouchKeyboard is open

alt text It covers my NGUI Input Box. Any suggestions please? I am a noob. :(

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 unity_eaKm_7FNf4Uaww · Mar 26, 2019 at 08:52 AM 0
Share

Hey did you get the answer?

avatar image Bongmo · Mar 26, 2019 at 10:54 AM 0
Share

$$anonymous$$aybe this helps:

On Android, when the on-screen keyboard is enabled, it causes an OnApplicationFocus( false ) event. Additionally, if you press Home at the moment the keyboard is enabled, the OnApplicationFocus() event is not called, but OnApplicationPause() is called ins$$anonymous$$d.

https://docs.unity3d.com/ScriptReference/$$anonymous$$onoBehaviour.OnApplicationFocus.html

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by highpockets · Mar 26, 2019 at 09:15 AM

The registration form is likely the game object that contains each field and you should be able to move it like so:

 registrationFormObject.transform.position = new Vector2(desiredXValue, desiredYValue);

If you wanted to do it smoothly so it doesn't just pop up there from one frame to another you could add a lerp function for example:

 float timeCount = 0.0f;
 float offset = 50.0f; //Amount to move the form up
 Vector2 startPos;
 Vector2 endPos;
 
 void Start(){
 startPos = registrationFormObject.transform.position;
 endPos = new Vector2(registrationFormObject.transform.position.x, registrationFormObject.transform.position.y + offset);
 }
 
 voidUpdate(){
 
 if( TouchScreenKeyboard.visible ){
 
 registrationFormObject.transform.position = Vector2.Lerp(startPos, endPos, timeCount);
 
 timeCount = timeCount + Time.deltaTime;
 }
 
 }
Comment
Add comment · Show 9 · 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 unity_eaKm_7FNf4Uaww · Mar 26, 2019 at 10:35 AM 0
Share

I tried this but it is not working the form is moving to the lower right corner. I have a form which has three input fields , for 1st and 2nd input field there is no need to movement required. but when we type in the 3rd input field the keyboard hides the field. So I attached the script to third input field and the canvas. Here is my script: public GameObject registrationFormObject; float timeCount = 0.0f; float offset = 50.0f; //Amount to move the form up Vector2 startPos; Vector2 endPos;

 void Start()
 {
     startPos = registrationFormObject.transform.position;
     endPos = new Vector2(registrationFormObject.transform.position.x, registrationFormObject.transform.position.y + offset);
 }

 void Update()
 {

     if (TouchScreen$$anonymous$$eyboard.visible)
     {

         registrationFormObject.transform.position = Vector2.Lerp(startPos, endPos, timeCount);

         timeCount = timeCount + Time.deltaTime;
     }

 }
avatar image highpockets unity_eaKm_7FNf4Uaww · Mar 26, 2019 at 11:18 AM 0
Share

What have you set to registrationFormObject?? $$anonymous$$ake it a public variable and attach the object in the editor or do this:

 GameObject registrationFormObject;
 
 void Start(){
 
 registrationFormObject = GameObject.Find("ObjectName");
 }

$$anonymous$$y script was just an example, but I strongly doubt that 50.0f is the right number for the offset you want. You'll have to play with the offset value a bit to find the right distance to move the object.

I would think that you would want to move the whole form so you don't have the field you want to move overlapping another field, but maybe you have enough space between fields.

Cheers,

avatar image unity_eaKm_7FNf4Uaww highpockets · Mar 26, 2019 at 11:21 AM 0
Share

I have made it public and added the input field to registrationFormObject

Show more comments

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

17 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

Related Questions

Mobile keyboard questions 0 Answers

Android Keyboard Issues 0 Answers

Is it possible to have the Unity TouchScreenKeyboard permanently open? 0 Answers

My text in my TextMesh changes all TextMesh objects 1 Answer

Receiving UI/touch events while mobile soft keyboard is open 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