Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Killer : MonoBehaviour {
- // Use this for initialization
- void Start ()
- {
- StartCoroutine(DestoryRoots());
- }
- public static IEnumerable<GameObject> SceneRoots()
- {
- var prop = new HierarchyProperty(HierarchyType.GameObjects);
- var expanded = new int[0];
- while (prop.Next(expanded))
- {
- yield return prop.pptrValue as GameObject;
- }
- }
- static IEnumerator DestoryRoots() // this will kill my parent
- {
- foreach (var sceneRoot in SceneRoots())
- {
- Destroy(sceneRoot);
- yield return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment