N
N
Noortvel2017-04-21 11:58:09
C++ / C#
Noortvel, 2017-04-21 11:58:09

For or Update on an array of objects?

There are more than 10 gameObjects, with each of them you need to perform some actions (call a function, get set, etc.). And here I don't know what solution to apply. You can bypass all gameObjects with a for loop or hang a separate script for each of them and perform different actions through Update. Which way is better? It's just that if you use for, then there will be problems with multithreading.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Maximovich, 2017-04-21
@Noortvel

Unity is single-threaded by nature. Based on the stream of consciousness read above, it is not entirely clear what you need to do. How do you create GameObject's. If they have to perform each of their actions, then write components for each variation and hook them to the desired GameObject.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question