Switching materials with a delay

Hey everyone

I would like to change the material of my player when it gets hit, make it react for a few seconds and then go back to the previous material state, using blueprint please.


Use Set Material then a Delay or whatever reaction you have in mind, and then Set Material back again.
A nice option is to Switch on Int, and then use an Int variable which you change whenever you want to step through the materials.

To get the Set Material, search it in the right-hand side Palette rather than the RMB contextual menu.
Probably it should be done in the actor eventgraph which has the mesh component.

The problem with this way is that the instant change looks really unnatural. You could have a sort of flickery, stepped effect by flipping back and forth for a second or two really fast, again just using Delays.

If you’re a bit more demanding and want to ramp between two textures over time you can try using a scalar Parameter in your material, creating a Material Instance, then using a 0-1 curve to drive the value of the parameter, for instance if you were to Lerp between two textures based on the white-through-black blend in the Alpha channel. This stuff is conceptually pretty much the same as in UE3, so far as I can see.

Not to throw you astray but look up things like Interpolate Material Instance Parameters – anyhow, there are some material transitions in the content examples and youtube unreal engine on materials.


That should work Tom I don’t really need the materials to blend but is good to know about those options.

Thank you

In case someone needs it, here’s a tutorial on how to change materials at runtime with a delay. UE4 How to Switch Materials at Runtime using Blueprints in Unreal Engine 4 Tutorial - YouTube

Instead of using the OnBeginPlay event, use OnHit event and you’re done.