- Home /
Question by
Catlinman · Nov 23, 2012 at 04:58 PM ·
gameobjecttransformarraygetcomponents
Find all GameObjects with tag and add them to a transform array
As the title says, I would like to get all GameObjects with a tag and then access their transform components and add them to a Transform array.
Comment
Answer by Montraydavis · Nov 23, 2012 at 05:43 PM
var TransformArray : Array ;
function SearchAndAdd ( )
{
var counter : int = 0 ;
for ( var Entities in GameObject )
{
TransformArray[counter] = Entities.transform.position ;
counter ++ ;
}
}
Reads all game objects, and add it's position to an Array ( TransformArray )
Your answer
Follow this Question
Related Questions
Keep adding targets to a list 2 Answers
Instantiating from an object that's in an array 1 Answer
How do I check multiple gameObjects transform positions? 3 Answers
How can i get ONLY the childrens of a GameOnbject with GetComponentsInChildren method? 5 Answers
How to convert GameObject array to Transform array in C#? 2 Answers