主要功能有三个:
1.右键菜单自定义方法
2.获取选中预制体内的所有Image图片引用(打印出了路径)
3.该预制体用到的图片资源,被其他预制体引用的情况(打印出了引用的预制体路径)
具体看代码,有注释
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using System.IO;
public class GetPrefabImageDetal : EditorWindow
{
static List<string> spritePath = new List<string>();
static new string name = "";
static List<string> checkGuids = new List<string>();
static List<string> pList = new List<string>();
static Vector2 srPos;
bool isCheck = true;
public static void Open()
{
var rect = new Rect(0, 0, 400, 600);
GetWindowWithRect(typeof(GetPrefabImageDetal), rect, true);
}
//在Project下添加自定义功能
[MenuItem("Assets/CheckImg", false)]
public static void CheckImg()
{
GameObject go = Selection.act