0
\$\begingroup\$

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???

\$\endgroup\$
1
  • 1
    \$\begingroup\$ which is exactly your problem? could you tell us what have you tried so far and what do you have trouble with? \$\endgroup\$
    – Heisenbug
    Apr 10 '14 at 15:18
3
\$\begingroup\$

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.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.