public static async UniTask <string> OnEndEditAsync(this InputField inputField) { using (var handler = inputField.GetAsyncEndEditEventHandler()) { return(await handler.OnEndEditAsync()); } }
/// <summary> /// InputFieldが入力されるのを待つ /// </summary> /// <param name="token"></param> /// <returns></returns> private async void AwaitInputField(CancellationToken token) { IAsyncEndEditEventHandler <string> handler = _inputField.GetAsyncEndEditEventHandler(token); string input = await handler.OnEndEditAsync(); Debug.Log("InputField入力文字 : " + input); }
private async UniTaskVoid WaitForInputField(CancellationToken token) { // InputField テキスト入力完了 using (var handler = _inputField.GetAsyncEndEditEventHandler(token)) { while (!token.IsCancellationRequested) { var text = await handler.OnEndEditAsync(); Debug.Log(text); } } }
private async UniTask <string> AwaitInputField(InputField inputField, CancellationToken token) { string input = NotInput; while (input == NotInput) { inputField.Select(); IAsyncEndEditEventHandler <string> handler = inputField.GetAsyncEndEditEventHandler(token); input = await handler.OnEndEditAsync(); Debug.Log("InputNickName : " + input); } return(input); }