赞
踩
- /// <summary>
- /// // *** 清空子节点
- /// </summary>
- public static void ClearChildren(this Transform _tra)
- {
- int childcount = _tra.childCount;
- for (int i = 0; i < childcount; i++)
- {
- GameObject.DestroyImmediate(_tra.GetChild(0).gameObject);
- }
- }
- /// <summary>
- /// // *** 清空可见子节点
- /// </summary>
- public static void ClearActiveChildren(this Transform _tra)
- {
- int childcount = _tra.childCount;
- int tempindex = 0;
- for (int i = 0; i < childcount; i++)
- {
- if (_tra.GetChild(tempindex).gameObject.activeSelf)
- {
- GameObject.DestroyImmediate(_tra.GetChild(tempindex).gameObject);
- }
- else
- {
- tempindex++;
- }
-
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。