当前位置:网站首页>[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 .
边栏推荐
- AcWing 608. Poor (implemented in C language)
- Some tips on string conversion
- AcWing 606. Average 1 (implemented in C language)
- It really doesn't matter if a woman fails to pass the college entrance examination and buys thousands of villas in a counter attack
- 开源项目维权成功案例: spug 开源运维平台成功维权
- Android应用安全之JNI混淆
- Build your own website (18)
- Sha256 encryption tool class
- 【Unity编辑器扩展基础】、EditorGUILayout (一)
- 深度学习又有新坑了!悉尼大学提出全新跨模态任务,用文本指导图像进行抠图...
猜你喜欢
![[Beijing University of Aeronautics and Astronautics] information sharing for the first and second examinations of postgraduate entrance examination](/img/06/df5a64441814c9ecfa2f039318496e.jpg)
[Beijing University of Aeronautics and Astronautics] information sharing for the first and second examinations of postgraduate entrance examination

RemoteViews布局和类型限制源码分析

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

ArrayList源码解析

Prepare for Jin San Yin Si I. testers without experience in automated testing projects should look at it quickly
![[vi/vim] basic usage and command summary](/img/bc/0be3ae3f122c3c21b480e0678095a1.png)
[vi/vim] basic usage and command summary

纯纯大怨种!那些年被劝退的考研专业
Using MySQL database in the express framework of node

建立自己的网站(18)

Web3 security serials (3) | in depth disclosure of NFT fishing process and prevention techniques
随机推荐
What is data compliance? How to achieve data compliance?
Source code analysis of ArrayList
Software test interview classic + 1000 high-frequency real questions, and the hit rate of big companies is 80%
KDD 2022 | graph neural network generalization framework under the paradigm of "pre training, prompting and fine tuning"
Deep learning has a new pit! The University of Sydney proposed a new cross modal task, using text to guide image matting
不到一小时,苹果摧毁了15家初创公司
EMC RS485 interface EMC circuit design scheme
【Unity编辑器扩展基础】、EditorGUILayout (三)
After importing resources, unity also manually modifies the properties of resources? This code can save you a lot of time: assetpostprocessor
Using MySQL database in the express framework of node
智联招聘基于 Nebula Graph 的推荐实践分享
MapReduce project case 3 - temperature statistics
[unity Editor Extension Foundation], editorguilayout (I)
设置Canvas的 overrideSorting不生效
Levels – virtual engine scene production "suggestions collection"
Is there a threshold for opening futures accounts? How to open futures accounts safely on the Internet
【C语言】判断三角形
我的NVIDIA开发者之旅-Jetson Nano 2gb教你怎么训练模型(完整的模型训练套路)
RemoteViews布局和类型限制源码分析
自定义标题栏View