[Unity3d] mobile 3D Game Development: how to store and display the highest score (8) -- use touchscreenkeyboard to pop up the keyboard

Source: Internet
Author: User

When you connect to the Android device for debugging, you will find that the data cannot be normally input because no keyboard pops up. In this case, you need a new class: touchscreenkeyboard to bring up the keyboard.

Official Website instructions: touchscreenkeyboard

To put it simply, it is to solve the problem of on-screen keyboard and keyboard access for iPhone and Android.

This interface allows you to display different types of keyboards: ASCII, numbers, URLs, emails, and others.

Because the appearance of the keyboard may mask the user interface and whether the user interface is blocked is set by you.

Touchscreenkeyboard. Visible and touchscreenkeyboard. area should be used to determine whether the keyboard is displayed (activated) and which part of the screen is used.

Apple's API does not allow explicit direction keyboards.

Therefore, you can define your own settings if the keyboard needs to be automatically rotated to match a specific positioning device.


Related variables:

Text

Returns the text displayed by the input field of the keyboard. This

Active

Specifies if the keyboard is visible or is sliding into the position on

Done

Specifies if input process was finished (read only)

Wascanceled

Specifies if input process was canceled (read only)

Class variables:


Hideinput

Specifies if text input field above the keyboard will be hidden when

Autorotatetoportrait

Specifies whether the keyboard shocould be automatically rotated

Autorotatetoportraitupsidedown

Specifies whether the keyboard shocould be automatically rotated

Autorotatetolandscapeleft

Specifies whether the keyboard shocould be automatically rotated

Autorotatetolandscaperight

Specifies whether the keyboard shocould be automatically rotated

Area

Returns portion of the screen which is covered by the keyboard. Returns

Visible

Returns true whenever any keyboard is completely visible on the screen.


There is also a class method:

Open: opens the native keyboard provided by OS on the screen.




Make a slight modification in the previous Code and add a variable to determine whether a name needs to be entered,

private var keyboard : TouchScreenKeyboard ;private var enterName : boolean = false;

Call the touchscreenkeyboard open method to open the keyboard:

if (!enterName) {keyboard = TouchScreenKeyboard.Open(newName);enterName = true;}if (keyboard){newName = keyboard.text;}

Then, you will find that the Android device can be entered:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.