Unity工具 - 资源搜索
来源:互联网 发布:网络规划设计师是副高 编辑:程序博客网 时间:2024/05/05 13:57
转自:http://www.manew.com/thread-91059-1-1.html
查询一个资源在哪个场景被引用
using UnityEngine;using System.Collections;using UnityEditor;using System.IO;using System.Linq;using System.Text;using System.Text.RegularExpressions;public class FindReferences{ [MenuItem("Assets/Find References", false, 10)] static private void Find() { EditorSettings.serializationMode = SerializationMode.ForceText; string path = AssetDatabase.GetAssetPath(Selection.activeObject); if (!string.IsNullOrEmpty(path)) { string guid = AssetDatabase.AssetPathToGUID(path); string withoutExtensions = "*.prefab*.unity*.mat*.asset"; string[] files = Directory.GetFiles(Application.dataPath, "*.*", SearchOption.AllDirectories) .Where(s => withoutExtensions.Contains(Path.GetExtension(s).ToLower())).ToArray(); int startIndex = 0; EditorApplication.update = delegate () { string file = files[startIndex]; bool isCancel = EditorUtility.DisplayCancelableProgressBar("匹配资源中", file, (float)startIndex / (float)files.Length); if (Regex.IsMatch(File.ReadAllText(file), guid)) { Debug.Log(file, AssetDatabase.LoadAssetAtPath<Object>(GetRelativeAssetsPath(file))); } startIndex++; if (isCancel || startIndex >= files.Length) { EditorUtility.ClearProgressBar(); EditorApplication.update = null; startIndex = 0; Debug.Log("匹配结束"); } }; } } [MenuItem("Assets/Find References", true)] static private bool VFind() { string path = AssetDatabase.GetAssetPath(Selection.activeObject); return (!string.IsNullOrEmpty(path)); } static private string GetRelativeAssetsPath(string path) { return "Assets" + Path.GetFullPath(path).Replace(Path.GetFullPath(Application.dataPath), "").Replace('\\', '/'); }}
0 0
- Unity工具 - 资源搜索
- Unity资源清理工具
- 打造世界最强资源搜索工具
- 【Unity资源】实用好用的源码工具
- unity资源
- windows 系统监控工具和本地资源搜索软件
- 搜索资源
- 资源搜索
- 资源搜索
- unity工具
- 资源工具
- 搜索工具
- 学习unity的资源
- Unity 资源搜集
- Unity 加载数据库资源
- Unity 创建资源包
- Unity 下载资源包
- Unity入门资源指引
- PHP 字符串获取 substr 与 strstr 函数
- 分页
- For循环
- dhcpd.conf分析
- JS调用方法实现向数组末尾追加该数组的第一个元素
- Unity工具 - 资源搜索
- 百度富文本编辑器UEditor自定义上传图片接口
- UIButton获取标题文字
- 模仿喜马拉雅
- 分区以3个数据库为例
- VC++入门经典学习笔记--纯虚函数
- while 语句累计运算语句
- LeetCode-----4. Median of Two Sorted Arrays
- linux中spi驱动框架