Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to change color of individual model in my game. But when I use

effect.DiffuseColor = newColor

then all of models which were loaded from same model file change color too.

How can I do ?

share|improve this question

you are changing the Diffusecolor in the same effect.

there is no easy way to clone a model

so the answer is before draw set the color properly for each model

// Draw method
foreach (ModelMesh mesh in m.Meshes)
    foreach (BasicEffect effect in mesh.Effects)
       effect.DiffuseColor = newColor;   
share|improve this answer
In addition to this I would be setting the Diffuse color from an the mesh object. This way you can have a default color being applied to the effect if no Diffuse color is needed. – FrenchyNZ Nov 8 '11 at 17:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.