Skip to content

Instantly share code, notes, and snippets.

@Tenebrous
Created October 31, 2018 10:37
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tenebrous/db7f6e9087d34b73de5d45c82263d131 to your computer and use it in GitHub Desktop.
Save Tenebrous/db7f6e9087d34b73de5d45c82263d131 to your computer and use it in GitHub Desktop.
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