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]
- New blank project
- Start Content Cube and Cube Material
- Create a BP Actor with a HISM
- Set the mesh to starter cube, and material to start cube material
- Add 1 instance
- Num Custom Data Floats to 1
- 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.
- 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.
- This works as intended in editor, updating the base color to the random int value as expected.
- Standalone or Packaged game does not update
- The value appears visually only if you modify the HISM instance count or toggle any options.
- Duplicate this BP and replace with ISM - everything works as expected in standalone.