FairyGUI.CopyPastePatch.OnPaste C# (CSharp) Method

OnPaste() public static method

public static OnPaste ( InputTextField textField ) : void
textField InputTextField
return void
        public static void OnPaste(InputTextField textField)
        {
            TextEditor te = new TextEditor();
            te.Paste();
            #if UNITY_5_3_OR_NEWER
            string value = te.text;
            #else
            string value = te.content.text;
            #endif
            if (!string.IsNullOrEmpty(value))
                textField.ReplaceSelection(value);
        }

Usage Example

示例#1
0
        void DoPaste()
        {
#if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
            CopyPastePatch.OnPaste(this);
#else
            if (onPaste != null)
            {
                onPaste(this);
            }
#endif
        }