123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using System.Reflection;
- using UnityEngine;
- public class ClipboardHelper
- {
- private static PropertyInfo GetSystemCopyBufferProperty()
- {
- if (ClipboardHelper.m_systemCopyBufferProperty == null)
- {
- Type typeFromHandle = typeof(GUIUtility);
- ClipboardHelper.m_systemCopyBufferProperty = typeFromHandle.GetProperty("systemCopyBuffer", BindingFlags.Static | BindingFlags.NonPublic);
- if (ClipboardHelper.m_systemCopyBufferProperty == null)
- {
- throw new Exception("Can't access internal member 'GUIUtility.systemCopyBuffer' it may have been removed / renamed");
- }
- }
- return ClipboardHelper.m_systemCopyBufferProperty;
- }
- public static string clipBoard
- {
- get
- {
- PropertyInfo systemCopyBufferProperty = ClipboardHelper.GetSystemCopyBufferProperty();
- return (string)systemCopyBufferProperty.GetValue(null, null);
- }
- set
- {
- PropertyInfo systemCopyBufferProperty = ClipboardHelper.GetSystemCopyBufferProperty();
- systemCopyBufferProperty.SetValue(null, value, null);
- }
- }
- private static PropertyInfo m_systemCopyBufferProperty;
- }
|