当前位置:网站首页>Script for unity3d to recursively search for a node with a specific name from all child nodes of a node
Script for unity3d to recursively search for a node with a specific name from all child nodes of a node
2022-06-12 06:04:00 【VR technology Xiaoguang】
public class SearchChild : MonoBehaviour
{
static Dictionary<string, Transform> buffer = new Dictionary<string, Transform>();
private static Transform FindChild(Transform FatherTrans, string childName)
{
if (childName == "")
return null;
Transform child = FatherTrans.Find(childName);
if (child != null)
return child;
Transform go = null;
for (int i = 0; i < FatherTrans.childCount; i++)
{
child = FatherTrans.GetChild(i);
go = FindChild(child, childName);
if (go != null)
return go;
}
return null;
}
public static Transform FindChildFast(Transform FatherTrans, string childName)
{
if (buffer.ContainsKey(childName))
return buffer[childName];
else {
Transform child = FindChild(FatherTrans, childName);
buffer.Add(childName, child);
return child;
}
}From the given Transform Start searching down for nodes with specific names , It also has cache function , For acceleration .
边栏推荐
猜你喜欢

Findasync and include LINQ statements - findasync and include LINQ statements

Front desk display LED number (number type on calculator)

Directx11 advanced tutorial cluster based deffered shading

dlib 人脸检测

Project and build Publishing

Unable to access this account. You may need to update your password or grant the account permission to synchronize to this device. Tencent corporate email

Login authentication filter

The application could not be installed: INSTALL_ FAILED_ TEST_ ONLY

What is the lszrz protocol used at ordinary times? Talk about xmodem/ymodem/zmodem

Es6-es11 learning
随机推荐
Directx11 advanced tutorial cluster based deffered shading
Getting started with houdininengine HDA and UE4
(UE4 4.27) add globalshder to the plug-in
R language homework (IV): GDP value analysis of Shanghai and Tokyo from 1997 to 2018
Annotation configuration of filter
Leetcode-1706. Where does the club fall
Un mois de DDD hépatique.
基于LFFD模型目标检测自动标注生成xml文件
从传统网络IO 到 IO多路复用
Brief summary of software project architecture
UE4 4.27 modify the mobile forward pipeline to support cluster multi light source culling
Redis memory obsolescence strategy
EBook editing and deleting
China embolic coil market trend report, technical innovation and market forecast
将一个文件夹图片分成训练集和测试集
Es6-es11 learning
Nrf52832 custom services and features
Nrf52832 -- official routine ble_ app_ UART adds the LED feature to enable the computer UART and mobile app to control the LED on and off of the development board
Database Experiment 3: data query
How to split a row of data into multiple rows in Informix database