Thomas ICHÉ
5 年前
当前提交
f6139776
共有 3 个文件被更改,包括 70 次插入 和 8 次删除
-
36Editor/FindAndReplace/FindAndReplaceWindow.cs
-
31Runtime/GameObjectExtensions.cs
-
11Runtime/GameObjectExtensions.cs.meta
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public static class GameObjectExtensions |
|||
{ |
|||
public static IEnumerable<Transform> GetAllChildren(this Transform transform) |
|||
{ |
|||
var stack = new Stack<Transform>(); |
|||
stack.Push(transform); |
|||
while(stack.Count != 0) |
|||
{ |
|||
var t = stack.Pop(); |
|||
yield return t; |
|||
|
|||
for (int i = 0; i < t.childCount; i++) |
|||
{ |
|||
stack.Push(t.GetChild(i)); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public static IEnumerable<GameObject> GetAllChildren(this GameObject gameObject) |
|||
{ |
|||
var all = gameObject.transform.GetAllChildren(); |
|||
foreach(Transform t in all) |
|||
{ |
|||
yield return t.gameObject; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 043df10a698bef24f85a021cc54479c2 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue