- Home /
Programatically create cube and assign different colors to each side
Say I have an empty GameObject
and I want to attach a script to it that creates a cube with each side having a different color when the game is run. How can I do this?
easiest would probably be using shader code, the issue is seperating out the cube into 6 different sides so you can change each separate. Unity only really supports by default changing the whole color easily. it's quite possible to break it up into different sides in the shader but you'd need how to shader code which is annoying. Perhaps just create 6 planes that'd be easy to change the color of each ins$$anonymous$$d of a cube.
Your answer
Follow this Question
Related Questions
Render mesh by specifying color of triangle 1 Answer
Change mesh color with shader or Mesh.colors? 1 Answer
can anybody help with script that takes webcam texture pixel information to deform mesh vertices? 0 Answers
How to Make Imported MagicaVoxel 3D Object Flash White 0 Answers
setting vertex color of mesh not working 2 Answers