Unity3D-查找资源被那里引用
来源:互联网 发布:数据库是什么意思 编辑:程序博客网 时间:2024/04/30 00:19
using UnityEngine;using UnityEditor;using System.IO;using System.Linq;using System.Text.RegularExpressions;using System.Collections.Generic;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); List<string> withoutExtensions = new List<string>() { ".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('\\', '/'); }}
本文固定链接: http://www.xuanyusong.com/archives/4207
转载请注明: 雨松MOMO 2016年06月29日 于 雨松MOMO程序研究院 发表
0 0
- Unity3D-查找资源被那里引用
- 【Unity3d】查看引用资源的文件
- unity3d--动态加载资源和查找资源的方式(1)
- 我的资源去那里了?
- Unity3D 资源
- 资源引用
- [Unity3D]BuildPipeline.PushAssetDependencies 打包依赖包,优化UI Prefab的资源引用加载
- Unity3D官方资源包的下载以及从Asset Store下载后存在的位置查找
- 【Unity3D】Unity3D 美术资源规范
- Unity3D引用dll教程
- Unity3D视频资源
- Unity3D资源整理
- Unity3d 音效资源
- unity3d资源总汇
- unity3d AssetBundles 资源包
- unity3d WWW加载资源
- Unity3D 加载资源
- [unity3d]加载模型资源
- Zookeeper简介-Zookeeper的数据保持在内存
- apt-get 命令笔记
- MYSQL 数据库 事务 隔离级别
- Spark源码分析之Scheduler模块(TaskScheduler)
- 浮夸背后的工业机器人政府竞相投资是内耗
- Unity3D-查找资源被那里引用
- Android——BitMap的使用
- i=i++问题(C语言)
- 手机APP测试点总结
- java 导出excel文件------第一种方法
- 求字符串中连续无重复子字符串的最大长度 (Longest Substring Without Repeating Characters)
- android studio导入工程出错(网络摘取)
- Python 运算符
- 剑指Offer 32 从1到n整数中1出现的次数