Set Custom Data Value Node Mark Render State Dirty Not Working in Standalone For HISM. Works for ISM

Setting a custom data value via per instance custom data node, Mark Render State Dirty true, for a given mesh within the Hierarchical Instanced Static Mesh component does not update properly at run-time for standalone or packaged games. Works fine in editor viewport or PIE.

Found this while attempting to solve this issue: [Material Custom Primitive Data Not Updating Each Frame In Standalone - Fine In Editor - Rendering - Unreal Engine Forums][1]

Repeatable Steps

  1. New blank project
  2. Start Content Cube and Cube Material
  3. Create a BP Actor with a HISM
  4. Set the mesh to starter cube, and material to start cube material
  5. Add 1 instance
  6. Num Custom Data Floats to 1
  7. In actor BP, on event tick, use Set Custom Data Value node to set instance index 0 and custom data index 0 to a value driven by Random Integer node. Check the Mark Render State Dirty bool.

  1. In cube material, add a PerInstanceCustomData node. Route that into VertexInterpolator node. Route the interpolator into DebugScalarValues node. Route the debug into base color to see it on the cube.

  1. This works as intended in editor, updating the base color to the random int value as expected.
  2. Standalone or Packaged game does not update
  3. The value appears visually only if you modify the HISM instance count or toggle any options.
  4. Duplicate this BP and replace with ISM - everything works as expected in standalone.

4 Likes

Hi, it seems fix is pretty trivial, but you will need sources to fix it.

Basically editor enforces CPUAccess with GIsEditor and we need to mimic that behaviour, we know how many custom float we will provide in the future, soo using NumCustomDataFloats > 0 should be fine, of course one may use different condition.

Fix is only valid for UE4.27.