what is [ ]

what is the difference when code gameobject has " [1] " and when it doesn’t

well your either talking about an array or a clone.

if you clone an existing object, it gets a 1 after the name to give it a different name

this is simply to help you distinguish between two identical objects. You can remove it by setting the names equal to another. Unity still knows the difference between them (they have different memory addresses, so just like you and your neighbor being identical twins with the same name wouldn’t actually make it that likely your mail goes to the wrong one, unity stores them in different spots and which memory address you reference tells it which one to mess with)

but assuming your not talking about arrays that’s what it means.

if your talking about arrays, it’s either an array of size one if it’s a declaration or if you see something like

gameobject Objects[10];

Objects[1] =…

in that case [1] means the second object in the array.

you can think of an array like a list.


is a collection of ten, in this case game objects.

instead of writing 10 lines of code to create 10 objects, you write one to create a list of ten objects.

Object[1] is a reference to, well actually the second item on the list.

arrays and most counting in programming actually starts at 0.

the first item in an array is the “zeroth” and is referenced via


the size though is actually it’s size and doesn’t contain zero which means if you write


it will contain gameobject[0] gameobject[1] gameobject[2]