Supported on
Sync Materials
SyncMaterials keeps named properties on a material in sync across the session.
Use it for a team color, a highlight that everyone should see, or any material
value that is part of shared game state.
Component Inputs
| Name | Type | Description |
|---|---|---|
| Network Id Type | Object Id or Custom | How the network id is generated. Defaults to Object Id. |
| Custom Network Id | string | Shown when Network Id Type is Custom. Defaults to enter_unique_id. |
| Auto Clone | boolean | Clones the material so this object's synced values do not affect every other object sharing it. Defaults to true. |
| Main Material | Material | The material to sync. Required. |
| Property Names | string[] | The material property names to keep in sync. |
If Main Material is left empty the component logs You need to set mainMaterial! and does nothing else.
Auto Clone
Materials in Lens Studio are shared assets. Without cloning, syncing a property writes to the material itself, so every object using it changes. Auto Clone is on by default for that reason. Turn it off only when you deliberately want the change to apply everywhere the material is used.
Related
- Storage Property:
forMaterialProperty,forMeshVisualProperty,forMeshVisualBaseColor. - Sync Transform
Was this page helpful?