Back to API Reference
Class
UniTextClipboard
static
Cross-platform system-clipboard access. Routes through Provider to the active IClipboardProvider; convenience static methods on this class cover the plain-text fast path that most integrators need.
Remarks
Bypasses Unity's GUIUtility.systemCopyBuffer — that API delivers plain text only and goes through Unity's editor abstractions, missing OS-level features the real clipboard exposes (Win32 CF_HTML, NSPasteboard, UIPasteboard items, etc.). Each platform uses its native clipboard API directly; integrators that need multi-format access (HTML paste from Word / Notion / Chrome, images, custom in-app formats for atomic-token round-trip) go through
Provider.SetItems / TryGetText / GetData. Per-platform format support: PlatformFormats WindowsPlain (CF_UNICODETEXT), HTML ("HTML Format" with CF_HTML header), Markdown / UniText source / custom (registered formats, UTF-8 + NUL), URL (UniformResourceLocatorW + text/uri-list), PNG (registered "PNG" + synthesized CF_DIBV5 both directions), files (CF_HDROP). macOSAll formats as pasteboard UTIs in one atomic write (public.html, net.daringfireball.markdown, com.lightside.unitext, public.url, public.png / jpeg / gif, custom UTIs verbatim), files (public.file-url). iOSSame UTI mapping via the native plugin; one items dictionary per write. UIPasteControl feeds captured payloads past the paste-permission prompt. AndroidPlain + HTML in one ClipData (newHtmlText); vendor / custom MIMEs advertised in the ClipDescription with payloads carried by an in-process cache (same-app round-trip; the platform clip has no per-MIME binary slot); images via FileProvider content URI. WebGLAsync Clipboard API: text/plain, text/html, text/uri-list, image/png native; anything else through the Chromium web custom-format prefix (invisible to Firefox / Safari). Sync reads come from the capture cache the browser paste event fills; programmatic paste must use the async path. LinuxAny target via xclip / wl-clipboard subprocesses; reads accept any offered target, writes offer ONE format (plain preferred, else the richest single item). xsel is plain-text only. Prefer the async provider path — sync reads spawn a blocking subprocess. OtherGUIUtility.systemCopyBuffer plain-text fallback. Integrators wanting a mock for tests, a sandboxed clipboard, or platforms outside the shipped set assign Provider directly. Setting it to falls back to the platform default.public static IClipboardProvider Provider{ get; set }Active clipboard provider. Returns the platform default unless an integrator has installed a custom one. Assigning reverts to the default.
public static Task<string> GetTextAsync()Async plain-text read. On WebGL goes through navigator.clipboard.readText() (works for programmatic paste, not just hardware Ctrl+V) and requires a user-activation context. Other platforms wrap GetText in a completed task.
public static Task<string> GetTextAsync()Async read for any format. See GetTextAsync for the WebGL contract.
