Requesting walkthrough on how Dynamic Mesh and Materials work in PolySpatial

We’re seeing a lot of funny stuff when it comes to how dynamically updating meshes and materials work in AR polyspatial modes. In particular: in the editor, we see clones of objects when the play button is hit. We can find and update those objects in the editor, but in the simulator there is no obvious way to do this.

How are we meant to update a mesh dynamically in Polyspatial? Simply finding the mesh on the object’s MeshFilter and setting its properties doesn’t seem to work.

What about a material or material property (e.g. setting a Property or Keyword).

Thanks!

The essential function of PolySpatial is to create a synchronized copy of the Unity scene graph. When you run in editor play mode, this synchronized copy is created as a parallel set of GameObjects within Unity, hence the clones you’re seeing. When you run in the simulator, the parallel copy is created as a set of entities within RealityKit, and the additional GameObjects are not present on the Unity/C# side.

This should work, and is how you can update a mesh dynamically. Without knowing exactly how you’re attempting to update the mesh’s properties, I can’t tell what might be going wrong. Feel free to submit a bug report with a repro case and let us know the incident number (IN-#####) so that we can see what the problem might be.

This is handled through the normal mechanisms, like Material.SetColor and Material.EnableKeyword. However, only shader graph materials (versus standard materials like URP/Lit) can actually use the keyword properties.

Thanks for the quick reply. I’ll investigate further and see what I can turn up.

1 Like