How to get the current value of a scalar parameter on a material via Blueprint?

For toggling on and off you can simply just set affect world to false and true. That way the value’s are not changed on the light itself.

  • In terms of the material you can either save a float value on your blueprint on begin play that get’s the current value (which would be your starting(desired) value) and save that to another variable so you have that value saved.

Are you creating Dynamic material instances for your emissives? if so you can create a little more logic to let the brightness of the light itself drive the emissive strength with a multiplier in between to make sure the emissive value is in line with the strength of the light itself.

  • Alternatively you can swap materials, so when the light is supposed to be off you swap the emissive material with a non emissive version of the same material instance.

  • Or you can look into using MaterialParameterCollections

As far as I know there is no way to get the current set float value on a Material Parameter, but there should be enough options to figure out a way to get around that which might even be easier.

If you have a specific example you can show I might be able to give you some more direction but in general either one of the above mentioned directions should work for your situation.

Hey everybody.

I have a generic light BP for handing various different artificial lights within my environment. As such, the value of some of the parameters will be set specifically to an individual BP instance. I’m trying to setup a function that will read the values of the set of parameters that are individualized so that I can save the values as references for situations like toggling whether a light is on or off for instance, and to have the original value be used when the light is turned back on, rather than going to a generic value.

I’ve been doing some digging and all of the solutions I’ve found require a lot more screwing around than they should, and I have no idea why; especially when setting the value is extremely simple in BPs.

Is there a straightforward method to get the value assigned to a parameter in an applied material instance and I’m just not seeing it, or is there as valid reason why this is so cumbersome (assuming the solutions I’ve found are the only ways to do it)?

Any help is greatly appreciated :slight_smile:

Thanks Unearthlywhales, your answer gave me an idea that does the job. I ended up coming at it from a different direction after reading your response. Rather than specifying the values in the materials, I set the values up as variables in the BPs and then used those to set the parameters, so the starting / desired value is set in the BP without ever setting it up in the material.

I’m obviously too tired to be trying to figure things out on my own tonight lol.

Thanks again! I’m going to look further in the MP collections as well, but that will have to wait till another day.

Happy to help, and yeah basically you kinda have to see materials as slaves not drivers for logic in a sense.

Get some good rest and work it with a fresh mind next time :wink:
Good luck!