调用EditorGUIUtility.IconContent(“icon name”) 填充editor ui 内容。
GUIContent defines what
to render and GUIStyle defines how
to render it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class MyUnityTextureWindow : EditorWindow {
[MenuItem(("Window/My UnityTextureWindow"))]
static void Init(){
EditorWindow.GetWindow<MyUnityTextureWindow>("MyUnityTextureWindow");
}
Vector2 m_Scroll;
List<string> m_Icons = null;
void Awake(){
m_Icons = new List<string>();
Texture2D[] t = Resources.FindObjectsOfTypeAll<Texture2D>();
foreach(Texture2D x in t){
Debug.unityLogger.logEnabled = false;
GUIContent gc = EditorGUIUtility.IconContent(x.name);
Debug.unityLogger.logEnabled = true;
if(gc != null && gc.image != null){
m_Icons.Ad