Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the event response of Mobile input method recognition by Unity NGUI

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how Unity NGUI to achieve mobile input method recognition event response, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's learn about it!

NGUI has implemented the listening function for events. See the following figure: On Return Key (select Snbmit). You can register listening events directly.

The implementation is as follows:

1. Build a simple scene

2. Create a new script InputTest.cs and mount it under the Input object, and drag and drop the assignment Txt_content, input

Using UnityEngine;// the author captures the enter event public class InputTest: MonoBehaviour {public UILabel txt_content; public UIInput input; void OnEnable () {EventDelegate.Add (input.onSubmit, ReturnCallBack);} void OnDisable () {EventDelegate.Remove (input.onSubmit, ReturnCallBack);} public void ReturnCallBack () {txt_content.text = input.value;}} by integrating InputField with the status of × × disk in update.

3. Run the game, enter the content in input and press enter, and content will assign the content you just entered (enter function is equivalent to the mobile confirmation button, which has been packaged for apk test)

The effect is as follows:

The above is all the contents of the article "how to realize Mobile input method recognition event response by Unity NGUI". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report