当前位置:网站首页>Unity 获取一个文件依赖的资源
Unity 获取一个文件依赖的资源
2022-04-23 06:28:00 【[奋斗不止]】
Unity 获取一个文件依赖的资源
在 Assets 文件夹下选择一个文件,获取文件路径,根据所选文件路径,获取该文件依赖的所有资源
在 Editor 文件夹下创建 AssetDepend.cs
using UnityEngine;
using UnityEditor;
using System.IO;
public class AssetDepend
{
[MenuItem("Assets/AssetDepend")]
static void Depend()
{
string[] guids = Selection.assetGUIDs;
foreach(var guid in guids)
{
string assetPath = AssetDatabase.GUIDToAssetPath(guid);
// 判断路径是文件
if (File.Exists(assetPath))
{
Dependencies(assetPath);
}
}
}
static void Dependencies(string assetPath)
{
// 是否迭代
bool recursive = false;
// 获取文件依赖的资源路径
string[] dependencies = AssetDatabase.GetDependencies(assetPath, recursive);
foreach(var path in dependencies)
{
Debug.Log(path);
}
}
}
版权声明
本文为[[奋斗不止]]所创,转载请带上原文链接,感谢
https://blog.csdn.net/LIQIANGEASTSUN/article/details/124323429
边栏推荐
猜你喜欢
利用Lambda表达式解决c#文件名排序问题(是100大还是11大的问题)
Scrapy 修改爬虫结束时统计数据中的时间为当前系统时间
King glory - unity learning journey
防抖和节流
Redis connection error err auth < password > called without any password configured for the default user
Date object (JS built-in object)
SAP ECC连接SAP PI系统配置
keytool: command not found
SAP CR传输请求顺序、依赖检查
js之节点操作,为什么要学习节点操作
随机推荐
One of event management
颜色转换公式大全及转换表格(31种)
js中对象的三种创建方式
js之DOM事件
Samplecamerafilter
事件管理之一
14. Transaction processing
系统与软件安全研究(五)
The page displays the current time in real time
事件系统(二)多播事件
MySQL8.0 安装/卸载 教程【Window10版】
Use of typescript dictionary
SAP PI/PO登录使用及基本功能简介
SAP PI/PO功能运行状态监控检查
NodeJS(二)同步读取文件和异步读取文件
快速排序
保研准备经验贴——18届(2021年)中南计科推免到浙大工院
Moment. Format of format method function in JS
学会使用搜索引擎
unity 屏幕自适应