Download

Can Parameter Values be added to Dynamic Material Instances without being pre-defined?

I’m guessing this is noob question but…

I’m looking at come blueprint script that a value is set on a Dynamic Material Instance by an external Blueprint and then that value is used internally on the Event Tick of the target blueprint. No where is there any established Material Parameter collection, which I might expect.

Am I just missing it or is it not defined.

Also “Create Dynamic Material Instance” by the “Set Scalar Parameter Value” instance as a way of casting? I mean “Create Dynamic Material instance” is defined in the “Construction Script”.

Okok, back up a sec, Here’s the full story:
So,the character controller is detecting a Primitive Component via a ray-cast and then applying “Create Dynamic Material Instance” so that it can “Set Scalar Parameter Value” on a target object. However, the Target object already calls “Create Dynamic Material Instance” in the Construction Script… and “Get Scalar Parameter Value” is being called in the Event Tick.

So… gotta say. Weirdest way to pass a value between objects I’ve seen. Using the Object’s material. I think that’s a bit hacky, no?

Presumably, I can create a base parent blueprint that can be used as my target object that can do it’s own material value manipulation how it might decide to do it.

That said, I don’t know what would be the equivalent of setting a public variable or triggering a custom event in that target.

Thoughts?

What’s the best practice in this situation. I want my player to target objects in my game by looking at them. Sure… material changes might be a part of it but that’s just a side effect.