Material set allows for switching the list of materials being used on a mesh dynamically at any given moment. It also allows for lengthening or shortening the list in real time, which can be used to [[Things_to_Avoid#Material "Stacking"|material stack (things to avoid)]].
<!--T:2-->
<!--T:2-->
Line 12:
Line 13:
|Target|{{RootFieldType|DriveRef`1|[[Type:SyncAssetList`1|SyncAssetList`1]]<[[Type:Material|Material]]>}}|TypeAdv1=true| The list of materials in a renderer to swap out.
|Target|{{RootFieldType|DriveRef`1|[[Type:SyncAssetList`1|SyncAssetList`1]]<[[Type:Material|Material]]>}}|TypeAdv1=true| The list of materials in a renderer to swap out.
|Sets|{{RootFieldType|SyncList`1|[[Type:SyncAssetList`1|SyncAssetList`1]]<[[Type:Material|Material]]>}}|TypeAdv2=true| The list of lists of materials in a renderer to swap out.
|Sets|{{RootFieldType|SyncList`1|[[Type:SyncAssetList`1|SyncAssetList`1]]<[[Type:Material|Material]]>}}|TypeAdv2=true| The list of lists of materials in a renderer to swap out.
}}
== Sync Delegates ==
{{Table ComponentTriggers
|OnSetupFromMeshRenderer:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Called when the setup from mesh renderer button is touched.
}}
}}
<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
{{stub}}
Attach this component to the same slot as a [[Component:MeshRenderer|Mesh Renderer]] or a [[Component:SkinnedMeshRenderer|Skinned Mesh Renderer]] and hit the <code>Setup From Mesh Renderer()</code> [[Sync Delegate|sync delegate]] to attach it to the material list. Next add a list ([[Type:SyncAssetList`1|SyncAssetList`1]]<[[Type:Material|Material]]>) of each material list to <code>Sets</code> you want to switch between. Lastly use <code>ActiveSetIndex</code> to switch between each list in <code>Sets</code> for <code>Target</code>.
<!--T:4-->
<!--T:4-->
== Examples ==
== Examples ==
{{stub}}
Can be used to switch a material set on an avatar to make them change material types ([[Component:XiexeToonMaterial|toon]] to [[Component:PBS Metallic|pbs metallic]]) or from active camo to not active camo, etc.
Material set allows for switching the list of materials being used on a mesh dynamically at any given moment. It also allows for lengthening or shortening the list in real time, which can be used to material stack (things to avoid).
Called when the setup from mesh renderer button is touched.
Usage
Attach this component to the same slot as a Mesh Renderer or a Skinned Mesh Renderer and hit the Setup From Mesh Renderer()sync delegate to attach it to the material list. Next add a list (SyncAssetList`1<Material>) of each material list to Sets you want to switch between. Lastly use ActiveSetIndex to switch between each list in Sets for Target.
Examples
Can be used to switch a material set on an avatar to make them change material types (toon to pbs metallic) or from active camo to not active camo, etc.