In your material, multiply the opacity by a scalar parameter “Opacity”
Then, in blueprint, when the player enters your trigger :
Get your decal actor
Get its material
“Create Dynamic Material Instance” based on this material
Put this new dynamic material on your decal with “Set Decal Material”
Create a timeline that interpolates a float from 1 to 0 in X seconds (to your liking)
At every update of the timeline : “Set Scalar Parameter Value” on the dynamic material : with the parameter “Opacity” and use the current float value from the timeline
Since i’m a newbie at blueprints, I don’t know where goes what. I managed to create a timeline with 2 seconds delay from 0 to 1 (for the Opacity parameter), but I can’t update the value. I can’t even change the Parameter Name.
Oh yeah, that node. The thing is : there are two “Set scalar parameter value” nodes available. One is for Parameter Collections (the one you got) and one is for Dynamic Materials. See how the node wants a collection asset? It’s the wrong one for your needs. That happens often to me too, since they have the same name.
I suggest that you drag out the blue pin from the “Create Dynamic Material Instance” and then type to find the “Set Scalar Parameter Value” node. Since the blue pin is a dynamic material, the context sensitive search will only show the right “Set Scalar Parameter Value” node.
That aside, you also have to connect the output of the “Create Dynamic Material Instance” node (your newly created material) to the “New Decal Material” input of the “Set Decal Material”. Then you also need to connect your decal actor to Target of that “Set Decal Material”. That way the new material will be put on the decal actor.
You’re almost there!
PS: As a general rule, dragging the pin of the element you want to act on really helps to find what you can do with it. Keeping the context sensitive activated and typing to find what you want to do. It will only show nodes that work with that element. Moreover, like in the case of that Set Scalar Parameter, sometimes nodes don’t show up if you don’t have the target element dragged out. You can turn off Context Sensitive in that case to see ALL nodes ever and then figure out what the node requires.
It didn’t occur to me that there is also a few different “Create Dynamic Material Instance” nodes. I swear it’s pretty confusing. In your set-up you can simply plug your material (from the decal) in the “Parent” input instead of the "World Context " and it should work! Honestly, I don’t know what this "World Context " is for, and why the material is automatically put there instead of “Parent”. This node takes a parent material and makes a dynamic one based on it. Right now there’s no parent material defined so it doesn’t output anything.
If you want to get a cleaner code, you can use the other “Create Dynamic Material Instance” node. It looks like this :
This one sets the material on the actor in the same node, so you wouldn’t need the “Set Material node”
Ahh, thanks for the heads up about the “duo” Set scalar parameter value. Would’ve never guessed about that.
I have one last problem: My target of Set Scalar Parameter Value seems to only link with Return Value from Create Dynamic Material Instance, but it keeps returning an error on log. Do I have to create another Create Dynamic Material Instance after the Set Scalar Parameter Value?
Haha, it worked! I don’t know how to thank you enough, but you deserves all the cookies of the world. =) This blueprint system can be quite helpful, but very stressful at the same . Thanks again for the amazing help.
Sorry to bump an old thread but I found this when googling how to fade out decals.
You can just hook up the Decal Lifetime Opacity node into the opacity, then use the decal actor’s class settings to adjust it - these can all be referenced and set in the event graph. Way easier than using timelines imo!