external textures

Hy guys!
I’m workin on a project in Unity. The project build will be a standalone player.

My problem is that I want my textures to be stored external (let’s say in the Data folder of the standalone build). I want to have 2 folders for textures: one for high-rezolution textures, and one for low-resolution textures. When I load a level I want it to use one of the 2 folders of textures (either high or low).

My project will have a “graphical settings” option in the menu, and when I switch between high and low setting I want to reload my level using the coresponding texture folder.

I have no idea how I can do that. How I can load a level and tell Unity to get the needed textures from a specified folder.
Maybe someone has a hint. Thanks

Is there any particular reason why you need to load the texture files from an external folder (so the user can modify them, say)? This page in the docs explains how to use the Resources.Load function to access assets at runtime, but they are included within the Unity project rather than a separate folder.

If you need to load data from a file in the standalone, you can do it using the Mono IO classes, and then decode to a texture using Texture2D.LoadImage to decode the raw data (as long as it’s PNG or JPG).

I think it’s easier to use the WWW class in combination with the “file://” locator for loading textures.

–Eric

Excellent - yes, I never thought of that! :slight_smile:

I recommend not using WWW for the Data folder, as it can fail on Vista if the program is in Program Files. System.IO.File works best for that.

I might be overlooking something obvious here, but wouldn’t it be easiest to use Unity’s built in Quality Settings to control this?

Thanks for replies.

First of all, the Quality Settings option from Unity, I can’t use it, because that will set all textures used in the level to Full Res, Half Res or Quarter Res. I only want some of the textures in the level to be changed based on a graphic setting in the game, not all of them.

Now, to load the texture from outside using Resources (or WWW, or System.IO.File, or AssetBundles,…) might be a solution. But how do I implement that?
I guess I have to load the textures used in the level (either the High res ones or the Low res ones; based on the game graphical setting choice), then load the actual level, that was saved without the textures.

Then when the user changes the graphical setting (lets say from High to Low), I have to unload the level, unload the High res textures, load the Low res textures and load again the level saved without the textures.

But how do I save, or build a level (or scene) in Unity, without the textures saved in it? Or better with some of the textures saved in the level and others not?

And another question: If I load the textures, and then load the level without the textures, than the objects in the level will automatic get the textures from the ones I loaded?

Check some of the underlined links in the previous posts - they will take you to the appropriate page of the manual.

You don’t need to reload a whole level to change textures. You can change the texture on an object at any time from a script using renderer.material.mainTexture.