- Home /
Prefab material
Hey,
I have a lot of prefabs in my project, and I would like to create the same prefabs with different textures (for example, I have a platform with a blue texture, and I would like to have a version with a yellow texture). How should I do it?
Answer by Waz · Jul 01, 2011 at 11:27 AM
Add a very simple enum or int to the prefab which allows you to select the material from a list in the prefab, then modify the renderers from code to use the selected material when this enum/int is changed (including in the editor, since the level designer will presumably want to see them with the right textures).
This way you can easily add more textures just by changing the set of materials. Ideally, if all blue prefabs used one material etc, then the list of materials wouldn't even need to be in each prefab, but just be Resources or listed in some single object in your scene.