# How to create public Arrays of game objects so that they can be assigned through inspector

I am making a unity2D game. I need to declare public array of gameobjects so that I can assign them colliders, textures through inspector by drag n drop. Is there any way to do this? I am using c#.

I found but not able to figure this out.Here is one link that is not useful for me please tell why???

• which is exactly your problem? could you tell us what have you tried so far and what do you have trouble with? Apr 10 '14 at 15:18

## 1 Answer

Why do you need a public array for that? If you just want to create GameObject by drag and dropping you can do that in the Scene hierarhcy.

If you need to access them later in a script then you can declare a public list:

public List<GameObject> myList = new List();


Then just drag and drop the objects to that list.