- Home /
Count multiple objects!
Hey,
I have a problem. I want to count multiple objects, but how do I do this? I've searched a lot on this website, but I could not find anything. He must count the cubes (a tag I can give them if necessary), and if there are 0, he must do something. For example Debug.Log("Hey");
Does anyone know how you do that?
Answer by save · Aug 19, 2011 at 09:54 AM
I've always seen Unity as a she, never the less -
You can do something like this:
function Start () {
if(CountCubes()==0) {
print("Hey");
}
}
function CountCubes () : int {
var cubes : GameObject[] = GameObject.FindGameObjectsWithTag("cube");
return cubes.Length;
}
But it's far better to keep track of quantities by adding or subtracting a single integer when you spawn or remove objects.
Answer by jomaikke · Aug 19, 2011 at 12:15 PM
Sorry, but it does not work :(
That's not an answer. Please comment on answers by using Comment
Answer by sdfwefwedfgherhr · Aug 20, 2011 at 01:52 PM
ONLINE STORE:
====( http://popbuynow.com/ )=====
The website wholesale for many kinds of fashion shoes, like the nike,jordan,prada,, also including the jeans,shirts,bags,hat and the decorations. All the products are free shipping, and the the price is competitive, and also can accept the paypal payment.,after the payment, can ship within short time.
Air jordan(1-24)shoes $30
Handbags(Coach l v f e n d i d&g) $35
Tshirts (Polo ,ed hardy,lacoste) $15
Jean(True Religion,ed hardy,coogi) $30
Sunglasses(Oakey,coach,gucci,A r m a i n i) $15
New era cap $12
Bikini (Ed hardy,polo) $20
accept paypal and free shipping
====( http://popbuynow.com/ )=====
====( http://popbuynow.com/ )=====
====( http://popbuynow.com/ )=====
====( http://popbuynow.com/ )=====
====( http://popbuynow.com/ )=====
====( http://popbuynow.com/ )=====
Your answer
