L
L
Loshka242021-12-03 10:21:57
Unity
Loshka24, 2021-12-03 10:21:57

How to assign game objects to an array in Unity?

Such a question, for example, I have an array with numbers from 1 to 10 and I need to assign a GameObject to each element of the array. In principle, it can be implemented through a switch case and a public access modifier to the GameObject, but I would like to optimize the code a little, thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2021-12-03
@GavriKos

Nothing is clear. If you have an array with numbers, then no gameobjects will be put there.
If you need a "number-gameobject" relationship, then the Dictionary will help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question