Quantcast
Channel: Questions in topic: "count"
Viewing all articles
Browse latest Browse all 187

How to count child dynamically?

$
0
0
I know that using transform.childCount will print the number of child in a parent. but it only prints one. How to will I know the number of children when it is dynamically changing at a runtime? here's my code public class StructureChecker : MonoBehaviour { void Start(){ update(); } public void update(){ foreach (Transform t in transform.parent) { Debug.Log (t.transform.childCount); } if (transform.childCount == 0) { Debug.Log ("Structure is full"); } else { Debug.Log ("Still has child"); } }

Viewing all articles
Browse latest Browse all 187

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>