How to change Textures after build the game?


The idea is this . The game brings a default textures , but I want the user be able to change them if he/she wants. I dont know if it is possible to do this , and if so , how do I do?

I have two things in mind:

  1. The user adds textures in a specific folder , using specific names and sizes , so that after, the game detect and load the textures.

  2. Using an interface that allows the user to find, select and load the textures by object…

What do you recommend me ?

How do I load the textures ?

And if there is a better way, please tell me

Thank you very much.

The solutions are both possible, but implementing the second one is much more difficult than the first (no GUI, no scripting, etc)

If you really want the second solution, you will have to make a file browser (some are free over the web). For a custom one see the .NET File and Directory classes :

Then, you could simply copy the selected file by the user with the appropriate .NET function :

You won’t have to “load” a texture, but simply copy it in the appropriate folder (inside the Resources folder : Unity - Scripting API: Resources) with the appropriate name.

I think #1 is a better solution, saves you from having to create different UI components in the game. Simply load and atlas textures when the game boots by checking a folder for files by name. If the file matches a name for each file, then it simply replaces it. There’s a number of basic methods for doing that so I won’t go into them; I would simply say the first one is the better option.