Created
May 17, 2013 02:10
-
-
Save masa795/5596470 to your computer and use it in GitHub Desktop.
AssetDatabase.GetCachedIconを使用してアイコンとラベルを表示する。
AssetDatabase.GetAllAssetPaths()で取得するのでファイル数が多いと重くなるかも。
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 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