4using System.Runtime.InteropServices;
11#if UNITY_WEBGL && !UNITY_EDITOR
12 [DllImport(
"__Internal")]
13 private static extern void PasteManagerSetup();
25#if UNITY_WEBGL && !UNITY_EDITOR
36 var currentCurrentSelectedGameObject = EventSystem.current.currentSelectedGameObject;
37 if (currentCurrentSelectedGameObject !=
null)
39 var inputField = currentCurrentSelectedGameObject.GetComponentInChildren<InputField>();
40 if (inputField !=
null)
43 $
"{inputField.text.Substring(0, inputField.selectionAnchorPosition)}{value}{inputField.text.Substring(inputField.selectionFocusPosition)}";
44 inputField.text = newText;
Represents a Class used to add paste capabilities to WebGL projects.
static PasteManager Instance
The Paste Manager Singleton instance.
static void CheckInstance()
Checks if the Singleton instance exists.
void Paste(string value)
Called when the user pastes the given value in the Web-Browser.