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

How to use FindGameObjectWithTag to get 0

$
0
0
I've been trying to use a simple script to count the number of GameObjects to print to a GUI. I can't figure out how to properly do it. My difficulty is that Length always returns 1. How should I change this code? public static int count = 0; private GameObject[] getCount; void Update () { getCount = GameObject.FindGameObjectsWithTag("BallsTag"); count = getCount.Length; }

Viewing all articles
Browse latest Browse all 187

Trending Articles



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