当前位置:网站首页>Unity gets the resources that a file depends on
Unity gets the resources that a file depends on
2022-04-23 07:51:00 【[struggling]】
Unity Get the resource that a file depends on
stay Assets Select a file under the folder , Get file path , According to the selected file path , Get all the resources that the file depends on
stay Editor Create under folder 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);
// Determine whether the path is a file
if (File.Exists(assetPath))
{
Dependencies(assetPath);
}
}
}
static void Dependencies(string assetPath)
{
// Iteration
bool recursive = false;
// Get the resource path that the file depends on
string[] dependencies = AssetDatabase.GetDependencies(assetPath, recursive);
foreach(var path in dependencies)
{
Debug.Log(path);
}
}
}
版权声明
本文为[[struggling]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230627004646.html
边栏推荐
猜你喜欢
随机推荐
'NPM' is not an internal or external command, nor is it a runnable program or batch file
UnityShader基础
Dropping Pixels for Adversarial Robustness
移动布局(flex布局、视口标签)
03use of scanner class (console input)
Electronic builder package error: proxyconnect TCP: Dial TCP: 0: connectex
MySQL8.0 安装/卸载 教程【Window10版】
异步的学习
颜色转换公式大全及转换表格(31种)
事件管理之一
js之作用域、作用域链、全局变量和局部变量
将指定路径下的所有SVG文件导出成PNG等格式的图片(缩略图或原图大小)
How does Apache Hudi accelerate traditional batch mode?
js之DOM学习三种创建元素的方式
企业微信免登录跳转自建应用
SVG中年月日相关的表达式
ABAP CDS VIEW WITH ASSOCIATION示例
js之什么是事件?事件三要素以及操作元素
NodeJS(一) 事件驱动编程
The problem of exporting excel form with wireframe and internal spacing of form by using web form