study/first_study/Library/PackageCache/com.unity.collab-proxy@1ec4e416a4af/Editor/UI/DrawCopyableLabel.cs
jh04010421 739d49f1a0 Unity | 2026.01.20
수업 실습 파일
2026-01-20 11:01:57 +09:00

34 lines
861 B
C#

using UnityEditor;
using UnityEngine;
using PlasticGui;
namespace Unity.PlasticSCM.Editor.UI
{
internal static class DrawCopyableLabel
{
internal static void For(string label, GUIStyle style)
{
Rect rect = GUILayoutUtility.GetRect(
new GUIContent(label), style);
GUI.Label(rect, label, style);
if (Event.current.type != EventType.ContextClick)
return;
if (!rect.Contains(Event.current.mousePosition))
return;
GenericMenu menu = new GenericMenu();
menu.AddItem(
new GUIContent(PlasticLocalization.Name.Copy.GetString()),
false,
() => EditorGUIUtility.systemCopyBuffer = label);
menu.ShowAsContext();
Event.current.Use();
}
}
}