Last active
July 27, 2018 00:46
-
-
Save nkjzm/9075af822eabe2963c5f5d05437f21a5 to your computer and use it in GitHub Desktop.
UnityでWindowsデスクトップアプリの仮想キーボードをハンドリングするスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.UI; | |
using UnityEngine.EventSystems; | |
using UnityKeyboard; | |
public class KeyboardManager : MonoBehaviour | |
{ | |
GameObject currentSelectable; | |
void Update() | |
{ | |
if (EventSystem.current.currentSelectedGameObject.Equals(currentSelectable)) | |
{ | |
return; | |
} | |
if (EventSystem.current.currentSelectedGameObject == null | |
|| !EventSystem.current.currentSelectedGameObject.activeInHierarchy) | |
{ | |
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR | |
TouchKeyboard.Close(); | |
#endif | |
return; | |
} | |
currentSelectable = EventSystem.current.currentSelectedGameObject; | |
if (currentSelectable.GetComponent<InputField>() != null) | |
{ | |
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR | |
TouchKeyboard.Open(); | |
#endif | |
} | |
else | |
{ | |
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR | |
TouchKeyboard.Close(); | |
#endif | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
こんにちは、こちらは
http://kohki.hatenablog.jp/entry/unity-windows-touck-keyboard
これの関連ソースでしょうか?
WindowsのScreenKeyboardをUnityから呼び出ししたく、参考にさせていただきたいのですがうまく実験できておりません
よろしければお教えください
よろしくお願いいたします。