Skip to content

Instantly share code, notes, and snippets.

@guimaraf
Forked from oismaelash/CopyToClipboardUnity.cs
Created March 18, 2019 15:43
Show Gist options
  • Save guimaraf/51b6ee715ed5989c74af476045a138a9 to your computer and use it in GitHub Desktop.
Save guimaraf/51b6ee715ed5989c74af476045a138a9 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class CopyToClipboardUnity : MonoBehaviour
{
[SerializeField] private string myText;
public void OnButtonCopyClipboardClicked()
{
TextEditor textForCopy = new TextEditor
{
text = myText
};
textForCopy.SelectAll();
textForCopy.Copy();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment