1.11.0: Added FieldLabelFromToString
This commit is contained in:
parent
a804633a14
commit
3a825efa2a
7 changed files with 39 additions and 1 deletions
|
|
@ -495,6 +495,10 @@ namespace Module.Inspector.Editor
|
|||
switch (property.propertyType)
|
||||
{
|
||||
case SerializedPropertyType.Generic:
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
if (property.boxedValue != null)
|
||||
return property.boxedValue.ToString();
|
||||
#endif
|
||||
break;
|
||||
case SerializedPropertyType.Integer:
|
||||
return property.intValue.ToString();
|
||||
|
|
|
|||
14
Editor/Predrawers/FieldLabelFromToStringAttributeDrawer.cs
Normal file
14
Editor/Predrawers/FieldLabelFromToStringAttributeDrawer.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.Inspector.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(FieldLabelFromToStringAttribute))]
|
||||
internal sealed class FieldLabelFromToStringAttributeDrawer : PredrawerModifierPropertyDrawer
|
||||
{
|
||||
public override void Modify(PredrawerModifierPropertyAttribute attribute, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
label.text = property.GetValueAsString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fddc7fa044dd4274a5776da1af9caaa9
|
||||
timeCreated: 1732461982
|
||||
Loading…
Add table
Add a link
Reference in a new issue