Can I make Serialize Field of a big array of prefabs without any issue?
Let's say I have a huge collection of powerUp gameObjects and I've created prefabs of them. Is it a good practice to serialize them to my script and then instantiating them from there? I'm pretty sure it isn't. But, If you can please offer a better solution.
Answer by hexagonius · Jan 21, 2016 at 09:00 PM
If it's huge it might be a big waste of memory if you preload them all. I think you should load them when needed with Resources.Load. It'll also speed up scene load
Thanks for answering. What if I want to make an endless runner and the road parts are prefabs?
well, if you need everything from the beginning you won't have much of a choice. if you however cluster them and you know when a new set is needed, you could load them in right before use. Like fist part is desert and after 1000 metres it becomes jungle. So it much depends on your use case. I think most useful is Resources LoadAll and LoadAsync
Your answer
![](https://koobas.hobune.stream/wayback/20220612061149im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Exporting gameobject to file using same mechanism as editor? 0 Answers
List of unused game objects and prefabs 1 Answer
How to recover missing prefab?,How to recover missing prefabs? 0 Answers
Is their a shortcut for adding the same object towards the scene? 1 Answer
GameObject - SetActive not working 1 Answer