I have a Material Function that changes the value of the Emission of a material.
All pickup objects in the game should use this material function.
As of now, what I’m doing is manually modify the base material of each object and add this material function.
Afterwards, this base material is used by a Dynamic Material because it has to do other stuff.
What I’d like to know is if it’s possible to dynamically add this material function as well.
Something like this:
Since your already have EmissiveColor as a parameter on your material you can use “SetVectorParameterValueOnMaterials”. Here is a snippet from my code:
Oh so the values you want to change at runtime are EmissiveMaxStrength and EmissiveDeltaTime? Then I would change those from constants to parameters (like EmissiveColor is now) and use SetScalarParameterValueOnMaterials instead.
If the problem is that you have several materials that use those parameters and you only want to change the emissive dynamically on one of them, maybe you can change the parameter name for that one that needs to be changed at runtime.