// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
#if UNITY_EDITOR
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
using static Animancer.Editor.AnimancerGUI;
using Object = UnityEngine.Object;
namespace Animancer.Editor
{
/// [Editor-Only] A custom Inspector for fields.
/// https://kybernetik.com.au/animancer/api/Animancer.Editor/StringAssetDrawer
[CustomPropertyDrawer(typeof(StringAsset), true)]
public class StringAssetDrawer : PropertyDrawer
{
/************************************************************************************************************************/
///
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
=> LineHeight;
/************************************************************************************************************************/
///
public override void OnGUI(Rect area, SerializedProperty property, GUIContent label)
{
label = EditorGUI.BeginProperty(area, label, property);
property.objectReferenceValue = DrawGUI(
area,
label,
property,
out var exitGUI);
if (exitGUI)
{
property.serializedObject.ApplyModifiedProperties();
GUIUtility.ExitGUI();
}
EditorGUI.EndProperty();
}
/************************************************************************************************************************/
private static readonly Func