MIDs aren't doing what i want them to...

Hi Brains trust,

so i am trying to pull out a material instance from a static mesh and then modify some of the material params to make it change colour etc.

I am gathering the mats like this:

the following 2 are both parts of the same function…and this populates the array (and presumably

I am then changing the param thusly:

and get the following output:

the param is this:

and if i change it from 0 → 1 → 2 → 3 in the mat instance it works as expected:

so everything seems to be perfectly in order - yet it doesn’t work…

wtf is going on? :stuck_out_tongue:

Your log is the useful part: PARAM AFTER is already 1.0, so Set Scalar Parameter Value is writing that MID. A wrong parameter name, or a material that is not an MID, would leave Get Scalar Parameter Value at 3.0. This is not a failed set.

On a modular kit (MI_Module_Status_*, group Module_Status_Visual) the usual reason the asset editor updates and the placed mesh does not:

  1. Open the parent material and select the scalar node Running Lights Status Switch. In Details, check Use Custom Primitive Data and its Primitive Data Index. If that is enabled, the shader reads the mesh component’s custom primitive data, not the MID scalar. The material-editor sphere has no primitive, so dragging the instance from 3 to 1 changes the preview, while at runtime Set Scalar updates the MID (your print) and the mesh ignores it. Either turn Use Custom Primitive Data off, or stop using Set Scalar and call Set Custom Primitive Data Float on the static mesh component at that index. CPD is per primitive, which is also why these kits use it for Nanite and instances.

  2. Confirm slots 2 and 11 are actually the surface you are looking at. The log only changes MID_MI_Module_Status_Running_Lights_902 and _903. MI_Panel1_body and MI_FixedColourSwatches are other slots. In the same loop, Set Vector Parameter Value on an emissive or base-color parameter you know is in that material, to pure green. If the module does not turn green, that MID is not the panel on screen (another component, or a second copy). If it turns green but the status color stays on the “3” look, the color is not coming from this scalar in the compiled shader.

  3. A pure static switch will not round-trip through Get/Set Scalar, so reading 3.0 then 1.0 means this name is a real scalar. Still check the graph for a second, static switch with a similar name that is what actually picks the color. Static switches update in the asset editor because it recompiles, and they ignore Set Scalar Parameter Value.

  4. Do not call Create Dynamic Material Instance again in this loop. You are already collecting the MIDs that are on the component. Creating another one replaces the slot and orphans the MID you just set. Setting both 902 and 903, which the loop already does, is what you want.

If Use Custom Primitive Data is on, Set Custom Primitive Data Float is the call that will move the placed module from the orange state (3) to the pale state (1).