I am working on a project and I have made a material that appear on a character, like a healing buff effectt, I am wondering is there any way to play that appearing effect once only though the material by no parametre control, just use Time to play it once. Now it keep repeating over and over again.
It has been driving me crazy these days. Hope someone can help for that.
If this is just a material and not an effect system like Niagara, the easiest would be to have some kind of control over when to play / when to finish playing the effect through blueprint.
if itās an effect on a permanent actor (like a character) itās material, you cant.
In such cases, youāll always need a little blueprint or other means to make it activate and deactivate.
If its possible, I must have missed something in this last decade
(which is very well possible :p)
You probably want a Dynamic Material instance ā itās a type of material whose parameters you can change at runtime in a Blueprint.
Hereās how it would work:
First, create a parameter in your material to allow you to fade the effect on and off
Create a dynamic material instance of that material in your blueprint constructor, and assign it to your character
When you want the effect to happen, change the parameter to blend the effect on and then off (probably using a timer or a curve)
I believe there are some examples of Dynamic Material usage in the UE docs. Or probably tutorials. But thatās exactly what you want ā itās designed for this use case.
I donāt think this is possible. Iāve been looking for this myself and couldnāt find a good solution.
The easiest is to set the StartTime vie blueprint (no need to create a dynamic instance btw, you can just set scalar directly).
If you donāt want to create blueprints for this every time, you could do a more generic solution via a Material Parameter Collection. E.g. you have a few different StartTimes params in your MPC and you set the one you need via a generic blueprint. This at least means you donāt need a direct reference to your material.
@Luos_83@FRGFX@BinaryBobby@TobiasTobasco
Thx for the solution, about the time value between 0 to 1, if I have a negative time like -1 to 1, is it going to cause bug, should I always make it 0 - 1? (sometimes it need so many calcution to return the value and I got confuse most of the time so I usually leave it as the way it was)
Since Twitter brought me here, Iāll give my thoughts on the issue:
Mathematically the solution by @TobiasTobasco works as long as youāre not using negative numbers as the duration (But why would anyone do that?). I would suggest updating the StartTime using Primitive Data. One issue I see here is that the effect will stay āonā indefinitely after the duration. This could be fixed by using a āfracā node after āsaturateā.
An alternative route would be to use Timers to modify a single Primitive Data parameter, instead of using Time.