unity, iterate immediate children and iterate all children
遍历所有直接子节点(immediate children):
foreach (Transform child in transform)
{
// do whatever you want with child transform object here
}
或
int childCount = transform.childCount;
for (int i=0; i<childCount; i++) {
Transform child=transform.GetChild (i);
}
注:transform.childCount返回的是直接子节点个数。
遍历所有子节点(包括根节点本身及所有子孙节点(grandchildren)):
Transform[] allChildren = GetComponentsInChildren<Transform>();
foreach (Transform child in allChildren) {
// do whatever with child transform here
}
参考:http://answers.unity3d.com/questions/10417/how-can-i-access-the-children-of-a-transform.html
unity, iterate immediate children and iterate all children的更多相关文章
- struts标签<logic:iterate>的用法
<logic:iterate>主要用来处理在页面上输出集合类,集合一般来说是下列之一: 1. java对象的数组 2. ArrayList.Vector.HashMap等 具体用法请参考s ...
- node与Elment以及子节点childrenNode与children的区别(2)
测试代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...
- Javascript DOM基础(二) childNodes、children
childNodes知识点: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Typ ...
- hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup
http://acm.hdu.edu.cn/showproblem.php?pid=4706 Children's Day Time Limit: 2000/1000 MS (Java/Others) ...
- HDU 4706:Children's Day
Children's Day Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) T ...
- HDU4706:Children's Day
Problem Description Today is Children's Day. Some children ask you to output a big letter 'N'. 'N' i ...
- struts1吊牌<logic:iterate>
<logic:iterate>主要用于处理网页上的输出集合,集合是其中一般下列之一: 1. java对象的数组 2. ArrayList.Vector.HashMap等 具体使用方法请參考 ...
- 由获取子元素的方法find和children所获
html代码如下 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://ww ...
- 【JAVASCRIPT】React学习-巧用 props 的 children 属性实现内容填充
背景 平常写组件,经常遇到需要获取内容放入组件内部的情形. 实现方法 我们有两种实现方式 1. 自定义 props render 的时候通过获取 this.props.content 填充到组件内部 ...
随机推荐
- VS2010 C++ 创建COM组件
1.项目中要使用到com组件,于是了解了一下com,并根据<C#高级编程>中关于com的介绍用vs创建了一下com,用于实验.以下均根据书中的demo做一遍,熟悉一下而已. 2.创建CoM ...
- FIS常用功能之MD5版本
静态资源后缀加上md5参数,有效解决缓存更新问题 fis release --optimize --md5 使用前后对比:
- HTTP 错误 404.0 - Not Found 您要找的资源已被删除、已更名或暂时不可用。
现象:打开一个页面,一直报404异常,但是文件是存在的,打开同一目录下的其它文件都没问题,改文件名也不行,始终找不到原因 解决方案:404异常是一个幌子,实际异常是页面读取了null值,应该报空引用, ...
- [Linux] Linux命令之pstree - 以树状图显示进程间的关系
转载自: http://codingstandards.iteye.com/blog/842156 pstree命令以树状图显示进程间的关系(display a tree of processes). ...
- [java] 模拟QPS
在WEB服务器端,每日的访问量巨大.在非生产环境需要对服务器进行压力测试,一般使用后台线程和Sleep方式来模拟线上的压力.这里使用ScheduledExecutorService实现一种简单的QPS ...
- [转]Oracle connection strings
本文转自:http://www.connectionstrings.com/oracle/ Standard Data Source=MyOracleDB;Integrated Security=ye ...
- Nios II uCLinux/Linux启动分析
1. 说明 本文采用的Linux源码版本来自Altera公司FTP.不考虑zImage生成的Compress过程.因为zImage是内核binary文件经过gzip 压缩,并在头部添加解压缩代码实现的 ...
- unity 拿shadowmap/ sample shadow map/拿_ShadowMapTexture
https://gamedev.stackexchange.com/questions/96051/unity-5-how-to-get-a-shadowmap UNITY_DECLARE_SHADO ...
- Junit参数化测试Spring应用Dubbo接口
一.创建基础类. package com.tree.autotest; import org.junit.Before;import org.springframework.context.annot ...
- 快速把web项目部署到weblogic上
转自:http://weijie.blog.51cto.com/340746/90420/ weblogic简介 BEA WebLogic是用于开发.集成.部署和管理大型分布式Web应 ...