Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
!W show Prefab Name
Browse files Browse the repository at this point in the history
  • Loading branch information
yika-aixi committed Jul 24, 2019
1 parent f488e01 commit be09d1a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Editor/PrefabWin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
namespace U3DExtends {
public class PrefabWin : EditorWindow
{
private static int _labelDefaultFontSize;

[MenuItem("Window/PrefabWin", false, 9)]
static public void OpenPrefabTool()
{
_labelDefaultFontSize = EditorStyles.label.fontSize;
PrefabWin prefabWin = (PrefabWin)EditorWindow.GetWindow<PrefabWin>(false, "Prefab Win", true);
prefabWin.autoRepaintOnSceneChange = true;
prefabWin.Show();
Expand Down Expand Up @@ -98,10 +101,11 @@ bool draggedObjectIsOurs
}
}


void OnEnable ()
{
instance = this;

Load();

mContent = new GUIContent();
Expand Down Expand Up @@ -615,6 +619,17 @@ void OnGUI ()
if (ent.tex != null)
{
GUI.DrawTexture(inner, ent.tex);
var labelPos = new Rect(inner);
var labelStyle = EditorStyles.label;
labelPos.height = labelStyle.lineHeight;
labelPos.y = inner.height - labelPos.height + 5;
labelStyle.fontSize = (int) (_labelDefaultFontSize * SizePercent);
labelStyle.alignment = TextAnchor.LowerCenter;
{
GUI.Label(labelPos, ent.prefab.name,labelStyle);
}
labelStyle.alignment = TextAnchor.UpperLeft;
labelStyle.fontSize = _labelDefaultFontSize;
}
else if (mMode != Mode.DetailedMode)
{
Expand Down

0 comments on commit be09d1a

Please sign in to comment.