- Home /
How would i make an object change color every second?
Thanks for taking your time to answer this. I am basically making a game where you collect cubes with a controller. I would like the cubes to stand out, and i would like them to flash every second. By flash I mean change color. I have tried something like this: gameObject.renderer.material.color = Color.red; ...but that doesn't seem to work. Is this because i am using unity 4? (I cant use 5 as i work on this at school) I have also tried:`renderer.material.color = Color.red;` I have heard of lerp()
, which smooths a change, but i will only use it if the flash doesn't work. I have looked at other question on this site and unity tutorial, but none seem to be any help...
Need more information.
is this script on the same gameobject as the renderer component of the cube?
gameObject.renderer.material.color = Color.red;
when/where are you calling this code?
Does the shader on the cube support colour?
Provide script and screenshot of cube setup (hierarchy/inspector) for more help.
Your answer
Follow this Question
Related Questions
Making 3D Objects invisible 1 Answer
Prefab starts halfway through object when placed down 2 Answers
Why is my object loading as black instead of the saved color? 1 Answer
Spawn random obiect 3d 1 Answer
Make object visible in dark 2 Answers