- Home /
resources not loadable in bulid
We have some resources in a resources folder of our project, which are loaded during runtime (.ogg files and text files which contain some descriptions for the levels). We use Resources.Load, to load these assets. In the Editor everything works fine. But if we make a final build (we tried for Mac, Windows and Android) the level is not build. The reason is obviously that the text files are not loaded. if i look into the log files, it seems, that the program tries to get it from the same folder as in the editor (which doesn't exist in the final build because unity stores the assets in some special files). We are not sure, what we did wrong or how to solve this problem. loading the files during runtime is necessary, because we have about 20 levels with over 1000 audio files. We don't want to assign them in the editor.
We'd appreciate any help!! Thanks!
Here similar problem is described. $$anonymous$$aybe this is the case ? http://answers.unity3d.com/questions/168868/how-do-i-include-a-custom-file-in-my-build.html
Yes, but there is no solution that helps me. Seems that the guy imported the files in the editor finally, which is no solution for me as I pointed out in the question. :)
Is this for Windows or $$anonymous$$ac? If so, you could just include the needed file with the build (make an Assets/Resources folder next to the executable and put your files here).
Answer by Graham-Dunnett · Jul 02, 2013 at 03:20 PM
Unity has a feature called `Resources`. Add your resources into a folder called Assets/Resources
. When the build is made, these assets will be wrapped up into a special file, which you can access using The `Resources.Load` API. Note that this API does not use file paths.
that means it doesn't work, if I use subfolders in the resources folder, but will work if everything is plain in one or more "root" - resources folders??
You can have subfolders inside the Resources
folder and you would include that subfolder as part of the path when you call Resources.Load()
. However, you would not include the file's extension. Like in the Project window in the Editor, Unity ignores the file extension for whatever reason.