x


Find and store gameObjects in a array

How i can find all gameObject with a certian tag in the scene and store them in a array?

more ▼

asked May 21 '10 at 10:17 PM

Mattivc gravatar image

Mattivc
1.7k 55 60 67

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

One line:

GameObject[] objects = GameObject.FindGameObjectsWithTag("myTag");

Note: Code is C#

http://unity3d.com/support/documentation/ScriptReference/GameObject.FindGameObjectsWithTag.html

more ▼

answered May 21 '10 at 10:23 PM

qJake gravatar image

qJake
11.6k 43 78 161

Going to sound stupid, but what's the equivilent of this line in Javascript? guessing it's var object : GameObject[] = GameObject.FindGAmeObjectsWithTag("MyTag"); but didn't see an exact reference for it when it came to arrays...

Dec 04 '12 at 04:38 PM Se7eNJinx
(comments are locked)
10|3000 characters needed characters left
var objects : GameObject[];
function Start()
{
objects = GameObject.FindGameObjectsWithTag("Tag");
}
more ▼

answered Mar 10 at 07:17 PM

NightShade2109 gravatar image

NightShade2109
1 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3442
x2070
x1356
x137

asked: May 21 '10 at 10:17 PM

Seen: 3285 times

Last Updated: Mar 10 at 07:17 PM