Hey folks,
to make life a bit easier for myself I wrote a script, which on start loops through all the folders in the Resource folder (using DirectoryInfo) and saves the name and path off the assets found. This way I can easily load assets simply by giving a name and a type (the script knows the saved path, and casts it to the correct type).
Whenever I make a build however, the script doesn’t work since all the data in the Resources folder gets put in one single asset.
So theres my question, is there any way to loop through all assets, and save the paths within a build?
Use your same DirectoryInfo process to write the paths to a text file that ships with your build. At runtime read the text file instead of the directories.
Thanks! I decided to try your way, and even though it feels a bit hacky it works.
Here’s the way you can look at it.
If there is a method/function out there that returns some data. Well that data had to be located somewhere for it to be queried from.
So if it’s not you storing that data, it would have been unity storing that data.
Why is it hacky for you to store it, but not hacky for them?
Unless you mean you think your storage mechanism isn’t optimized enough… but in that, I’d say. Isn’t it unoptimized to store the data in a generic term (unity doing it for you) if the majority of users don’t need it?
Here’s the first level of optimization for data. Only store the data you need.