/
Syncing Material Properties (Unity)

Syncing Material Properties (Unity)

Understanding how Unity handles material editing can influence your choice of components and scene hierarchy setup. To simplify this process, we offer various No-Code components for synchronizing material properties out of the box.

image-20240305-053617.png
Several different ways of modifying material properties are possible.

Sync Instance Materials

The SyncMaterialInstanceColor component selectively updates only the instance of a material assigned to a renderer, without impacting other instances. It's ideal for scenarios where you need to synchronize specific instances while maintaining independence for others.

 

image-20240305-165838.png
All three cylinders use the same material, however, the left object is not assigned a sync component and will not receive changes from modifying the center object’s instanced material.

 

image-20240305-172953.png

Sync Shared Materials

The SyncMaterialSharedColor component allows for easy color synchronization across objects sharing the same material without extra sync components. Any changes made to its properties affect all corresponding objects in the scene.

 

image-20240305-181915.png
Modifying the cylinder’s shared color property will affect all other objects with the same material.

 

 

image-20240305-181152.png

Syncing Material Textures

The SyncMaterialTexture component facilitates texture synchronization through a serialized collection of textures, using a key-value pair of string::texture. Swapping textures within this collection provides synchronization of textures.

 

image-20240305-171459.png

 

 

image-20240305-171548.png
Add desired textures which will be swapped during runtime. Also, note this component uses a direct reference to the material which will act as a shared material mentioned above.

 

Syncing Image Sprites

With the SyncImageSprite component, you can synchronize sprites similar to material textures mentioned above. Just populate the serialized list with the desired sprites, and you can easily swap sprites either manually or programmatically to sync.

 

image-20240305-172320.png
Simple UI that randomizes the display icon and syncs.

 

 

image-20240305-172350.png
Similar to syncing material textures, provide known-assets in the serialized list.

 

Custom Materials

It's important to note that the components mentioned above are exclusively compatible with Unity URP materials and shaders. In cases where custom materials with unique shaders are utilized, additional considerations are necessary. For developers, we offer more detailed guidance in our developer section, where custom component examples are provided to address such scenarios.

 

Related content