{"id":944,"date":"2014-01-08T11:22:34","date_gmt":"2014-01-08T11:22:34","guid":{"rendered":"http:\/\/www.clonefactor.com\/wordpress\/?p=944"},"modified":"2014-01-08T11:22:34","modified_gmt":"2014-01-08T11:22:34","slug":"unity3d-destroy-all-children-object","status":"publish","type":"post","link":"https:\/\/www.clonefactor.com\/wordpress\/program\/unity3d\/944\/","title":{"rendered":"Unity3D : Destroy all children object."},"content":{"rendered":"<pre class=\"brush:csharp\">using UnityEngine;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Kit\r\n{\r\n\tpublic class Hack {\r\n\t\tpublic static void DestroyAllChild(GameObject _obj, bool _immediate)\r\n\t\t{\r\n\t\t\tKit.Hack.DestroyAllChild(_obj.transform, _immediate);\r\n\t\t}\r\n\t\tpublic static void DestroyAllChild(Transform _transform, bool _immediate)\r\n\t\t{\r\n\t\t\tList&lt;GameObject&gt; _children=new List&lt;GameObject&gt;();\r\n\t\t\tforeach(Transform _child in _transform)\r\n\t\t\t\t_children.Add(_child.gameObject);\r\n\t\t\t_children.ForEach(delegate(GameObject obj) {\r\n\t\t\t\tif( _immediate ) MonoBehaviour.DestroyImmediate(obj);\r\n\t\t\t\telse MonoBehaviour.Destroy(obj);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n<p>\u7d93\u5e38\u8981 destroy child \u5beb\u4e00\u6bb5\u81ea\u7528\u7684 kit.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>using UnityEngine; using System.Collections; using &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[43],"class_list":["post-944","post","type-post","status-publish","format-standard","hentry","category-unity3d","tag-unity3d-2"],"_links":{"self":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/comments?post=944"}],"version-history":[{"count":0,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/944\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/media?parent=944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/categories?post=944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/tags?post=944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}