I’m making an iPad app “generator” which is supposed to make several different apps (difference is only in content) by loading stuff from the Resources folder.
I noticed that using LoadAll will sort the contents of the array alphabetically.
Is this guaranteed? The sequence/order for me is very important.
Sorry to bump this, but I would really like an answer 
Do you really want to ensure the app crashing by blindly loading into the blue even without knowing if the RAM has the slightest chance to hold it?
You better know what you have to load and load what you need.
Just sort them yourself
In C# with Linq
using System.Linq;
//…
Object[ ] res = Resources.LoadAll(“FolderInResources”);
Texture2D[ ] texs = res.Select(r => (r as Texture2D)).Where(r => r != null).OrderBy(t => t.name).ToArray();
GameObject[ ] objs = res.Select(r => (r as GameObject)).Where(r => r != null).OrderBy(t => t.name).ToArray();
Now I am not sure if the r!=null line will work. Basically that is just checking if our “as” cast failed. There are other ways of doing it of course. But why bother assuming a method will return things in alphabetical order when you can just order them yourself?
@dreamora: What are you talking about? Your answer seems to be more “pointing finger” than trying to help, better you not answer then. Who said anything about not knowing what I’m loading? I know what I’m loading, what I asked is a completely different thing…
Anyway
@Antitheory: Thanks! I guess this would then be the safest, since there is no way apparently to know the details around LoadAll
Hi Alph I’m trying to load a sequence of animated stills and I’m wondering the exact question, as the sequence playback seem to have some frames ordering artifacts, leading me to question the order of the objects in the array. Thanks for asking that question, and @anon_19585093 for providing a sort suggestion 