Hey, I was wondering if anyone knows how I can make an object flash a specific colour. Specifically, I’m trying to make an enemy flash red when they’ve taken damage, as a visual cue to the player that their attack is working, like :
I’ve tried looking online for tutorials but all I can find are tutorials on how to make a material pulsate in a particular colour. That’s kinda along the lines on what I’m trying to achieve but not quite the same thing, I only want the enemy to flash once and that’s it.
That is definitely possible. In fact, Unreal has a great Live Training that actually deals with effects and changing materials with blueprints on their YouTube page!
The appreciate the response but, ummm, seems a bit much. Isn’t there any simpler tutorials? My preferred method of working on my game so far has been to work my way up from doing simple, easy-to-do tasks and as I gain more knowledge & confidence in my abilities, gradually move up to more complex tasks. Meanwhile, that tutorial you’ve posted feels like I’m taking a course on constructing a medieval cathedral in order to learn how to build a sand castle.
So looking into it a bit more, evidently you can use a timeline to change the colour of an object as mentioned here and here.
I tried playing around with the colour timeline to see if I could get to work for my purposes but so far I haven’t had any luck at all in figuring out how it works.
I have a question about Dynamic Material Instance. Doesn’t it only affect one material instance? At least that’s the impression that I get from watching videos, which I feel like is going to be a bit of issue with enemies that are made up of multiple materials & other components.
The basic ‘Goomba’-type enemy for my game, for example, has separate materials from it’s body for it’s eyes & mouth, and it’s arms and legs are separate from the main body as well, in addition to the hat it wears on it’s head.
It just seems to me that making all the materials flash red separately is going to be a major time-consuming headache to implement. Isn’t there a way to just the entire object flash a colour instead of one material?
The PostProcessVolume: you only need to set a single material in the PPV and it will only affect those components that have ticked Render CustomDepth Pass.
The idea is to set it up so that it can be used on any actor. For I created an actor component that I can add to any actor that can recieve damage and it takes care of the rest:
I think @pezzott1 offered the most modular and non-destructive solution, but I’ll mention one other possible solution which probably isn’t a good idea but, depending on project specifics you never know:
that would be to have your flashing behavior on a master material and then your characters material instances can derive from that. It probably wouldn’t work in many cases but it could be an option in some.
I’ve followed all of your instructions & have constructed the material, as well as the actor component blueprint but I have one little issue. How I do actually invoke the hit flash within the enemy’s blueprint?