-
-
Save Tenebrous/db7f6e9087d34b73de5d45c82263d131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using UnityEditor; | |
using UnityEngine; | |
[InitializeOnLoad] | |
public static class ProjectPaneExtensions | |
{ | |
static ProjectPaneExtensions() | |
{ | |
EditorApplication.projectWindowItemOnGUI -= Draw; | |
EditorApplication.projectWindowItemOnGUI += Draw; | |
} | |
static GUIStyle _labelStyle; | |
static void Draw( string guid, Rect selectionrect ) | |
{ | |
var path = AssetDatabase.GUIDToAssetPath( guid ); | |
// skip invalid names | |
if( string.IsNullOrWhiteSpace( path ) ) | |
return; | |
// don't touch the two-column layout | |
if( selectionrect.height > 20 ) | |
return; | |
if( _labelStyle == null ) | |
_labelStyle = new GUIStyle( EditorStyles.label ); | |
var filename = Path.GetFileNameWithoutExtension( path ); | |
var extension = Path.GetExtension( path ); | |
var drawRect = selectionrect; | |
drawRect.x += _labelStyle.CalcSize( new GUIContent( filename ) ).x + 12; | |
drawRect.y++; | |
GUI.Label( drawRect, extension ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment