mirror of
https://github.com/maxartz15/ScriptableData.git
synced 2024-12-04 05:35:46 +01:00
Update ExtendedScriptableObjectDrawer.cs
This commit is contained in:
parent
f00c7d43aa
commit
087a0f7fdb
@ -16,7 +16,8 @@ namespace ScriptableData.Editor
|
|||||||
{
|
{
|
||||||
// Permamently exclude classes from being affected by the drawer.
|
// Permamently exclude classes from being affected by the drawer.
|
||||||
private static readonly string[] ignoredFullClassNames = new string[] { "TMPro.TMP_FontAsset" };
|
private static readonly string[] ignoredFullClassNames = new string[] { "TMPro.TMP_FontAsset" };
|
||||||
private const int buttonWidth = 20;
|
private static readonly GUIContent buttonContent = EditorGUIUtility.IconContent("d_ScriptableObject On Icon");
|
||||||
|
private const int buttonWidth = 16;
|
||||||
|
|
||||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||||
{
|
{
|
||||||
@ -106,7 +107,7 @@ namespace ScriptableData.Editor
|
|||||||
propertyRect.width -= buttonWidth;
|
propertyRect.width -= buttonWidth;
|
||||||
|
|
||||||
// Draw create button.
|
// Draw create button.
|
||||||
Rect buttonRect = new Rect(position.x + position.width - buttonWidth, position.y, buttonWidth, EditorGUIUtility.singleLineHeight);
|
Rect buttonRect = new Rect(position.x + position.width - buttonWidth, position.y + 1, buttonWidth, EditorGUIUtility.singleLineHeight);
|
||||||
DrawScriptableObjectCreateButton(buttonRect, property, fieldType);
|
DrawScriptableObjectCreateButton(buttonRect, property, fieldType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +127,7 @@ namespace ScriptableData.Editor
|
|||||||
|
|
||||||
private static void DrawScriptableObjectCreateButton(Rect position, SerializedProperty property, Type type)
|
private static void DrawScriptableObjectCreateButton(Rect position, SerializedProperty property, Type type)
|
||||||
{
|
{
|
||||||
if (GUI.Button(position, "+"))
|
if (GUI.Button(position, buttonContent, EditorStyles.iconButton))
|
||||||
{
|
{
|
||||||
GenericMenu typeChooser = new GenericMenu();
|
GenericMenu typeChooser = new GenericMenu();
|
||||||
IEnumerable<Type> types = type.Assembly.GetTypes().Where(t => type.IsAssignableFrom(t));
|
IEnumerable<Type> types = type.Assembly.GetTypes().Where(t => type.IsAssignableFrom(t));
|
||||||
|
Loading…
Reference in New Issue
Block a user