Hello community =)
I’m quite new in the game development and this question is more theoretically.
My situation: the scene contains multiple (up to 1000 at the end) items. They “sleep”. If the player comes close enough, they interact with him. After he goes far enough, they doing their thing for a while and come back to “sleep”.
Concept A: Every time i collide with something i instantiate the script _interactionScript to the GameObject i collide with. This script do his thing and destroy himself when the “work is done”.
Concept B: I have one main script. Every time i collide with something i put this Item into the _toDoArray (its a dynamic Array!). I check every time the length of this array and if it grater then 0 I start _interactionFunction(toDoArray*). When the “work is done” the function removes the item from toDoArray.*
What way is more efficient? Or is there beter one?
PS: sorry for my englisch, I’m not native.