Unity Windows 빌드에서 터치 키보드를 띄워 줍니다.
using UnityEngine;
using UniRx.Triggers;
using UniRx;
using UnityEngine.UI;
using UnityEngine;
using System.Diagnostics;
using System;
using System.Collections;
[RequireComponent(typeof(InputField))]
public class InputFieldOSK : MonoBehaviour
{
private InputField _inputField = null;
private Process _keyboard;
private void Start()
{
bool isWindow = Application.platform == RuntimePlatform.WindowsEditor
|| Application.platform == RuntimePlatform.WindowsPlayer;
if(!isWindow) return;
_inputField = GetComponent<InputField>();
_inputField.OnSelectAsObservable().Subscribe(_=> LaunchKeyboard());
_inputField.OnDeselectAsObservable().Subscribe(_ => OnInputDeselect());
}
private void LaunchKeyboard()
{
StartCoroutine(CoLaunchKeyboard());
}
IEnumerator CoLaunchKeyboard() {
if (_keyboard != null)
_keyboard = null;
yield return new WaitForSeconds(0.3f);
_keyboard = Process.Start("TabTip.exe");
}
private void OnInputDeselect()
{
if (_keyboard != null)
_keyboard = null;
}
}