I was looking for a way to copy a piece of text to the clipboard on iOS and Android devices the other day. There are ways to do it for Windows and Mac computers, but getting that to work for mobile devices seemed a bit trickier. There were some solutions on the Unity3D Community forums, but they were always either for iOS OR Android and required additional extra steps to make it actually work. Luckily, I found this handy script by Wataru Sanuki which handles cross platform copy to clipboard in a single class.
To copy text to clipboard, simply use:
UniClipboard.SetText (“text you want to clip”);
And to get to text from clipboard, just use:
UniClipboard.GetText ();
That’s it! You can download the script here: https://github.com/sanukin39/UniClipboard
Related Posts
December 19, 2011
Learning ROILA
The RObot Interaction Language (ROILA) is a new spoken language that is optimized for the communication between machines and humans
February 1, 2018
[FIX] Unity3D – Moving Files Failed Error When Making Build
I was trying out the Google Player Services plugin and got this error message when I was trying to make an Android build which prevented me from finishing the build.
February 11, 2012
[Fix] Joomla: Parameter 1 to modMainMenuHelper
How to fix Joomla - Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference