Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity c# store gameobject in array

private GameObject[] objects = GameObject.FindGameObjectsWithTag("mytag");
//Change private to public if you want it to be acessible from the inspector and other scripts.
//Add [HideInInspector] in front of public if you don't want it to be accessible in the inspector.

//Replace objects with the name of your array that is storing the GameObjects.

//Replace mytag with the tag you are looking for in the array.
 
PREVIOUS NEXT
Tagged: #unity #store #gameobject #array
ADD COMMENT
Topic
Name
1+2 =