diff --git a/Assets/WebGLSupport/WebGLInput/WebGLInput.cs b/Assets/WebGLSupport/WebGLInput/WebGLInput.cs index b7c92c1..90a545d 100644 --- a/Assets/WebGLSupport/WebGLInput/WebGLInput.cs +++ b/Assets/WebGLSupport/WebGLInput/WebGLInput.cs @@ -228,7 +228,25 @@ public void OnSelect() WebGLWindow.OnBlurEvent += OnWindowBlur; } - void OnWindowBlur() + /// + /// sync text from inputfield + /// + /// + public void SyncText(int? cursorIndex = null) + { + if (!instances.ContainsKey(id)) return; + + var instance = instances[id]; + + WebGLInputPlugin.WebGLInputText(id, instance.input.text); + + if (cursorIndex.HasValue) + { + WebGLInputPlugin.WebGLInputSetSelectionRange(id, cursorIndex.Value, cursorIndex.Value); + } + } + + private void OnWindowBlur() { blurBlock = true; } @@ -420,7 +438,7 @@ public int CompareTo(WebGLInput other) return res; } - public void CheckOutFocus() + private void CheckOutFocus() { if (!Application.isMobilePlatform) return; if (!instances.ContainsKey(id)) return;