当前位置:网站首页>[unity Editor Extension practice] find all prefabs referencing this picture
[unity Editor Extension practice] find all prefabs referencing this picture
2022-06-28 12:22:00 【Unique_ eight hundred and forty-nine million nine hundred and n】
Last one Unity Editor Extension practice 2 、 Find all prefabrications through code All the prefabricated bodies have been found in .
Then we can use these prefabricated bodies to do some other operations , For example, find the resource reference of the prefabrication . You can traverse the prefabrication directly , Find everything in the prefab Image Components , Then compare Sprite The value of the property , See if it is the same as the detected resources .
Prefabs.Clear();
if (m_sprite == null) return;
EditorUtility.DisplayCancelableProgressBar(" Find Atlas ", " Find a graph set ...", 0);
List<Image> aorImages;
List<GameObject> _prefabList = GetAllPrefabByAssetDatabase("Assets/Resources/TSUprefabs");
for (int i = 0; i < _prefabList.Count; i++)
{
if (_prefabList[i] == null)
{
continue;
}
aorImages = new List<Image>(_prefabList[i].GetComponentsInChildren<Image>());
if (aorImages == null|| aorImages.Count<=0)
{
continue;
}
foreach (var image in aorImages)
{
if (image.sprite==null)
{
continue;
}
if (image.sprite.Equals(m_sprite))
{
Prefabs.Add(_prefabList[i]);
break;
}
}
bool _cancel = EditorUtility.DisplayCancelableProgressBar(" Find Atlas ", " Find a graph set ("+i+"/"+ (float)_prefabList.Count+"...", i / (float)_prefabList.Count);
if (_cancel)
{
break;
}
}
EditorUtility.ClearProgressBar();Similarly, you can use this method to replace the picture for the desired preform , Just find the corresponding prefabricated components , Copy picture to Image Components .
To find a reference to an image, use this method , The same is true for other resources .
边栏推荐
- fatal: unsafe repository (‘/home/anji/gopath/src/gateway‘ is owned by someone else)
- 建立自己的网站(18)
- AcWing 604. Area of circle (implemented in C language)
- Remoteviews layout and type restriction source code analysis
- AcWing 609. Salary (implemented in C language)
- 我的NVIDIA开发者之旅-Jetson Nano 2gb教你怎么训练模型(完整的模型训练套路)
- . Net hybrid development solution 24 webview2's superior advantages over cefsharp
- Research on personalized product search
- cdc同步 如果数据库表的主键发生了变化,会同步成两个数据 还是会同步更新主键呢?
- 杰理之wif 干扰蓝牙【篇】
猜你喜欢

UGUI强制刷新Layout(布局)组件

Multi dimensional monitoring: the data base of intelligent monitoring

Tips for using ugui (V) using scroll rect component
![[C language] three sorting methods for random number files](/img/a5/363133a0c85aa43c6cd8287e479f71.jpg)
[C language] three sorting methods for random number files

【北京航空航天大学】考研初试复试资料分享

EMC RS485 interface EMC circuit design scheme
Using MySQL database in the express framework of node
![[unity Editor Extension practice], find all prefabrications through code](/img/0b/10fec4e4d67dfc65bd94f7f9d7dbe7.png)
[unity Editor Extension practice], find all prefabrications through code

【Unity编辑器扩展实践】、利用txt模板动态生成UI代码

开源项目维权成功案例: spug 开源运维平台成功维权
随机推荐
什么是泛型,怎么使用泛型分析
[C language] use of nested secondary pointer of structure
[C language] use of file read / write function
关于字符串转换的一些小技巧
UGUI强制刷新Layout(布局)组件
多维度监控:智能监控的数据基础
【vi/vim】基本使用及命令汇总
【C语言】判断三角形
Given two points and a point with a middle scale, find the coordinates of the point
【C语言】NextDay问题
Prepare for Jin San Yin Si I. testers without experience in automated testing projects should look at it quickly
【C语言】文件读写函数使用
杰理之wif 干扰蓝牙【篇】
Daily practice of C language - day 4: find the sum of all even numbers within 100
【Unity编辑器扩展基础】、EditorGUILayout (三)
Unity Editor Extension Foundation, guilayout
MapReduce project case 1
EMC RS485接口EMC电路设计方案
[unity Editor Extension practice] dynamically generate UI code using TXT template
Leetcode 48. 旋转图像(可以,已解决)