Skip to content

Commit 3d48610

Browse files
committed
Cleaned up some inspector issues
1 parent 0d380c9 commit 3d48610

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

Editor/Common/MetadataEditorInstance.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using UnityEngine;
33
using UnityEditor;
44
using System.Collections.Generic;
@@ -103,6 +103,9 @@ public void OnInspectorGUI()
103103
if (targets == null || targets.Length == 0 || metadata == null || metadata.Length == 0)
104104
return;
105105

106+
EditorGUI.indentLevel = 0;
107+
EditorGUIUtility.labelWidth = 0;
108+
106109
var rect = GUILayoutUtility.GetRect(GUIContent.none, InspectorLayout.inspectorTitlebar);
107110
showMetadata = InspectorLayout.FoldoutTitlebar(rect, showMetadata, metadataContent, false, InspectorLayout.inspectorTitlebar, InspectorLayout.inspectorTitlebarText);
108111
var controlId = InspectorLayout.lastControlId;
@@ -252,6 +255,7 @@ public void OnInspectorGUI()
252255
GUILayout.BeginVertical();
253256
if (metadataEditors != null)
254257
{
258+
EditorGUILayout.Space();
255259
// We seem to get the metadata in reverse order from the assetdatabase, compared to the order we add them
256260
// So to make things feel more consistent, we reverse the order
257261
for (int i = metadataEditors.Length - 1; i >= 0; i--)

Editor/LayoutUtility/InspectorLayout.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ public static bool FoldoutTitlebar(Rect position, bool foldout, GUIContent label
5454
{
5555
int controlID = GUIUtility.GetControlID(s_TitlebarHash, FocusType.Keyboard, position);
5656
var foldoutPosition = GetInspectorTitleBarObjectFoldoutRenderRect(position, baseStyle);
57+
foldoutPosition.x -= 7;
58+
foldoutPosition.width += 7;
5759
position.width += position.x;
5860
position.x = 0;
5961
Rect position2 = new Rect(position.x + (float)baseStyle.padding.left + (float)((!skipIconSpacing) ? 20 : 0), position.y + (float)baseStyle.padding.top, EditorGUIUtility.labelWidth, 16f);
62+
position2.x -= 7;
63+
position2.width += 7;
64+
6065
bool hover = position.Contains(Event.current.mousePosition);
6166
if (Event.current.type == EventType.Repaint)
6267
{

Runtime/Baseclass/CustomAssetMetadata.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ public abstract class CustomAssetMetadata : ScriptableObject
1111
// These methods are to handle creating and destroying metadata in the editor and not leave the asset dangling
1212
[Conditional("UNITY_EDITOR")] private void OnEnable() { if (asset != null) MetadataLookup.Register(asset, this); }
1313
[Conditional("UNITY_EDITOR")] private void OnDisable() { MetadataLookup.Unregister(asset, this); }
14+
15+
public UnityEngine.Object GetAssociatedAsset() { return asset; }
1416
}

0 commit comments

Comments
 (0)