How to exchange texture/material on a cube?

Hello everyone

For a game idea I need to be able to exchange textures (or whole material if this is easier) on a cube at runtime.
Example: There is a cube with 6 sides, with 6 different colors. I would like to exchange a single side color by another side color at runtime, so changing a single side wont affect the other cube sides?
Normally if you attach a material on a cube in Unity it repeats covering the whole cube, so the same material is on every side. Is there a way or a mechanism in Unity to access every single side of that cube?

Any hint is welcome
Tyger

Model the cube with 6 different textures; this way it will end up with an array of 6 materials in Unity, and you can change individual materials in the array.

–Eric

Thank you for your answer. I was thinking about something the same. The problem is probably that 6 textures are not enough because I can’t cant control inside Unity which texture (color) which texture on which side. The only way is by UV mapping. But that way working with 6 colors and 6 cube sides I have to implement 36 textures (each color on the UV map texture on every single cube side while around it everything is transparent). That way I can put every color on every side of the cube.

Greetings tnx
Tyger

You can…just change the texture on the appropriate material in the array. But if you have another way that works, that’s fine.

–Eric

Yes, exchanging the texture on the array. That works great, tnx!

Greetings
Tyger