Skip to content

Instantly share code, notes, and snippets.

@masa795
Created May 17, 2013 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masa795/5596470 to your computer and use it in GitHub Desktop.
Save masa795/5596470 to your computer and use it in GitHub Desktop.
AssetDatabase.GetCachedIconを使用してアイコンとラベルを表示する。 AssetDatabase.GetAllAssetPaths()で取得するのでファイル数が多いと重くなるかも。
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class FileIconTest : EditorWindow {
Vector2 scrollPosition;
[MenuItem ("Window/File Icon")]
public static void Init () {
FileIconTest.GetWindow(false, "FileIcon");
}
void OnGUI () {
scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false);
foreach (string path in AssetDatabase.GetAllAssetPaths())
{
Texture icon = AssetDatabase.GetCachedIcon(path);
if (icon != null)
{
GUILayout.BeginHorizontal();
GUILayout.Label(icon, GUILayout.Width(20));
GUILayout.Label(path);
GUILayout.EndHorizontal();
}
}
GUILayout.EndScrollView();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment