Changing object color at runtime

Hi
I am trying to change the object color during runtime, let’s say a cube or a plane

I know I might try to replace mesh but I think it is better to use “simpler way” to do it

Thank you.

in Material Tab -> Options check the ‘Object Color’.

Now you can change the object’s base color with Python obj.color = [1.0,1.0,1.0,1.0]
r,g,b,a

ar. i forgot to check “object color”
and one more question
RGB is 0 - 255
and in blender become 0 - 1
then the index is just simply 1 / 255 or what?

value of color scales from 0.0 to 1.0 in Python.

here is a little demo I made :smiley:

this uses actions, and a property,

this way to change the color you just set the property.

Attachments

ColorExample.blend (572 KB)