You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
517 B
C#
26 lines
517 B
C#
|
|
using UnityEngine;
|
|
using System.Runtime.InteropServices;
|
|
|
|
public class CopyAndPaste
|
|
{
|
|
|
|
#if UNITY_WEBGL
|
|
[DllImport("__Internal")]
|
|
private static extern void CopyToClipboardAndShare(string text);
|
|
[DllImport("__Internal")]
|
|
private static extern string GetCurrentUrl();
|
|
#endif
|
|
|
|
public static void Copy(string text)
|
|
{
|
|
#if UNITY_EDITOR
|
|
GUIUtility.systemCopyBuffer = text;
|
|
#endif
|
|
|
|
#if !UNITY_EDITOR && UNITY_WEBGL
|
|
CopyToClipboardAndShare(text);
|
|
#endif
|
|
}//Copy() end
|
|
|
|
}//class end |