- Home /
Changing Material in Animation
I have a light Bulb that goes off eventually through Animation. It has a Illuminated Material, I need to change the Material when the light goes off in Animation. How to do it?
I have both the Illuminated and off materials.
I mean I have a Bulb $$anonymous$$odel, and assigned a Illu$$anonymous$$ated $$anonymous$$aterial to it. I need to change the Illu$$anonymous$$ated material through Animation.
https://www.youtube.com/watch?v=z$$anonymous$$l8bl-mCdU
is this helpfull are you want something else?
Answer by CalebBennetts · Dec 10, 2020 at 04:49 PM
@ddulshan Well, five years later, but here's finally an answer. 1. In your animation timeline, add the property "Mesh Renderer" -> "Material Reference." 2. (optional) You may need to pull your "Project" tab into a new window so you can see both your list of materials and your animation timeline at the same time. 3. Click and drag the material you want from your list and drop it in the animation timeline.
Hopefully you figured something out and weren't trapped in developer limbo all this time, but I thought I would post in case anyone else has a similar question.
Answer by kbaloch · Feb 19, 2015 at 12:44 PM
1) start your animation 2) change your material using this
if( renderer.material == material1 ) {
renderer.material = material2;
}
else {
renderer.material = material1;
}
Thanks. But I don't know how to change during some time. I mean my bulb's light is Flickering through anim. So it changes eventually. How to trigger this At those times? Boolean?
if do you think you find clue about your question then accept the answer for others benefits.
what do you mean by some time ? can your explain what you want ?
I have an Anim clip attached to the Light, where the light is turned off eventually(for flicker effect). How do I change the $$anonymous$$aterial between these times(flickerings).
Your answer
Follow this Question
Related Questions
What is wrong with my shader? 1 Answer
AnimationEvent has no function name specified 2 Answers
Sprite animation from 2D to 3D 2 Answers
Can a 2D skybox be animated? 0 Answers
How do I link/animate a light with a shuriken particle system? 2 Answers