Advertisement
Muk99

Clipboard

Feb 12th, 2015
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using UnityEngine;
  2. using System;
  3. using System.Reflection;
  4.  
  5. public class Clipboard
  6. {
  7.     private static PropertyInfo m_systemCopyBufferProperty = null;
  8.     private static PropertyInfo GetSystemCopyBufferProperty()
  9.     {
  10.         if (m_systemCopyBufferProperty == null)
  11.         {
  12.             Type T = typeof(GUIUtility);
  13.             m_systemCopyBufferProperty = T.GetProperty("systemCopyBuffer", BindingFlags.Static | BindingFlags.NonPublic);
  14.             if (m_systemCopyBufferProperty == null)
  15.                 throw new Exception("Can't access internal member 'GUIUtility.systemCopyBuffer' it may have been removed / renamed");
  16.         }
  17.         return m_systemCopyBufferProperty;
  18.     }
  19.     public static string clipBoard
  20.     {
  21.         get
  22.         {
  23.             PropertyInfo P = GetSystemCopyBufferProperty();
  24.             return (string)P.GetValue(null,null);
  25.         }
  26.         set
  27.         {
  28.             PropertyInfo P = GetSystemCopyBufferProperty();
  29.             P.SetValue(null,value,null);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement