projectEli/Assets/Inventory System/ICWM Assets/Inventory/Scripts/ToolTip/ToolTipAttributes.cs

37 lines
1.1 KiB
C#

//********************************************************//
// //
// Copyright © All rights reserved. MyNameIsVoo. 2020. //
// //
// REPRODUCTION FORBIDEN //
// //
//********************************************************//
using UnityEditor;
using UnityEngine;
namespace ToolTipAttribute
{
public class TooltipAttribute : PropertyAttribute
{
public readonly string text;
public TooltipAttribute(string text)
{
this.text = text;
}
}
#if UNITY_EDITOR
[CustomPropertyDrawer(typeof(TooltipAttribute))]
public class TooltipDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
{
var atr = (TooltipAttribute)attribute;
var content = new GUIContent(label.text, atr.text);
EditorGUI.PropertyField(position, prop, content);
}
}
#endif
}