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 am having a problem with assigning a colour to the different meshes that I have on one object. The technique that I have used is the first approach on this site. Is it possible to export a simulation (animation) from Blender to Unity?

So what I would like to do is the following. I have about 107 meshes that are different frames from my shape key animation of my blender model. What I would like to have is that the first mesh will be bright green and up to the 40th mesh the colour turns to be white /greyish...

the best would be if I could assign every mesh by hand a colour, however they are all default materials. And if I assign the object a colour, the whole "animation" is going to be in that colour

share|improve this question

There are different approaches to this problem. It depends a lot on the look you're trying to achieve.

Texture/Color each Mesh separately

If you want full control over the the resulting animation, this is the way to go. But this is also really cumbersome if you have to set up several animations.

How to do it? Instead of using an array of Mesh objects as your "frames", you could use an array of GameObject. The GameObject can have an individual material, colliders etc. Then instead of swapping the mesh, you would swap (toggle visibility) of the different game-objects.

Animate the color of the material

You could add a start- and end-color variable to your script and interpolate between these colors by altering the renderer.material.color property over time. Depending on the type of material/shader you used, this might work out of the box or will need some tweaks on your material-setup. This is presumably more efficient (and certainly less cumbersome to set up) than swapping GameObjects, but I haven't tested the performance.

Here's the MeshAnimation script from my other answer, but this time with start- and end-color built in as an example:

share|improve this answer
thank you so much!! That is exactly what I was looking for :) – Salino Jun 22 '12 at 9:54
@Salino glad this helped. Feel free to accept my answer then :) – bummzack Jun 22 '12 at 9:57

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.