ClipboardHelper
Unity3D/Script / 2014. 5. 15. 02:08
출처 : http://answers.unity3d.com/questions/266244/how-can-i-add-copypaste-clipboard-support-to-my-ga.html
- // C#
- // ClipboardHelper.cs
- using UnityEngine;
- using System;
- using System.Reflection;
- public class ClipboardHelper
- {
- private static PropertyInfo m_systemCopyBufferProperty = null;
- private static PropertyInfo GetSystemCopyBufferProperty()
- {
- if (m_systemCopyBufferProperty == null)
- {
- Type T = typeof(GUIUtility);
- m_systemCopyBufferProperty = T.GetProperty("systemCopyBuffer", BindingFlags.Static | BindingFlags.NonPublic);
- if (m_systemCopyBufferProperty == null)
- throw new Exception("Can't access internal member 'GUIUtility.systemCopyBuffer' it may have been removed / renamed");
- }
- return m_systemCopyBufferProperty;
- }
- public static string clipBoard
- {
- get
- {
- PropertyInfo P = GetSystemCopyBufferProperty();
- return (string)P.GetValue(null,null);
- }
- set
- {
- PropertyInfo P = GetSystemCopyBufferProperty();
- P.SetValue(null,value,null);
- }
- }
- }
반응형
'Unity3D > Script' 카테고리의 다른 글
Unity Serializer (0) | 2014.09.25 |
---|---|
Simple C# Unity Serializer (0) | 2014.09.25 |
유니티 코루틴 깊이 알고 재미있게 쓰기. (0) | 2014.05.09 |
ScreenWipe CrossFade with C# (0) | 2014.04.22 |
A simple cross fade shader for Unity (0) | 2014.04.22 |