Creating an array of objects in the order they are in a folder?
Hello,
I have a folder in my resources folder called Levels. Inside this, i store all my levels as prefabs that can be instantiated when needed. I firstly load them into an array using Resources.LoadAll("Levels")
The levels in the folder are named as follows: Level,Level 2,Level 3 etc
In the folder, they are in order so level is first, then level 2 and then level 3. But when i create an array, they are not in order, for some reason. My question is how i can make sure the array is created in the order the prefabs are in the folder.
Any help is greatly appreciated, thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220612052457im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Spawn prefabs from array in specific order given the size of prefab 1 Answer
AI to shoot other AI 1 Answer
Array 2D of data 1 Answer
how to predefine an order to destroy objects on Unity? 0 Answers