MID created in construction script has empty param array

A MaterialInstanceDynamic created in the construction script has an empty scalar parameter array, even if it definitely has scalar parameters present.

Here is a test actor demonstrating the issue (4.15.1) - just drop it into a map and note the editor log output.

  1. First it prints out the ScalarParameterValues array from the source material instance (“Value” and “RefractionDepthBias”).
  2. Then it creates a MID and attempts to print the ScalarParameterValues array in the same way, but it is empty.
  3. After that, it prints out the length of the MID scalar parameter array (0), and then gets the “Value” parameter using the “GetScalarParameterValue” node, and it returns the correct value (0.5), to show that the parameter is definitely present in the MID, but not in the array.

The array in the MID is filled correctly at BeginPlay, so I’m guessing it’s filled after the construction script runs. I’m guessing this could be by design, for optimisation or something, but if it doesn’t do any harm it’d be useful to have that array reflect the parameters as soon as the MID is created.

Hi Spoondog,

I’m not entirely sure if this is an intended result or a small error regarding Dynamic Material Instances. I have reproduced this behavior and decided to enter a ticket for it here: Unreal Engine Issues and Bug Tracker (UE-44362)

You can track the ticket as it is reviewed by our development staff. Keep in mind that this may not be addressed or fixed quickly.

Cheers,

Ed