Component:MeshRenderer: Difference between revisions

From Resonite Wiki
m Added to Renderer Category
add info
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<languages></languages>
<languages></languages>
<translate>
<translate>
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=MeshRendererComponent.png
|Image=MeshRendererComponent.png
|Name=MeshRenderer
|Name=MeshRenderer
}}
}}
== Intoduction == <!--T:1-->
<!--T:1-->
The '''MeshRenderer''' component is used for rendering static 3D meshes in the world, and applying materials to that mesh.
The '''MeshRenderer''' component is used for rendering static 3D meshes in the world, and applying materials to that mesh.
== Usage ==
 
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|Mesh|Mesh| The mesh to be rendered. Can be a [[StaticMesh (Component)|StaticMesh]] or a [[:Category:Components:Assets:Procedural Meshes|Procedural Mesh]]
|Mesh|{{RootFieldType|AssetRef`1|[[Type:Mesh|Mesh]]}}|TypeAdv0=true| The mesh to be rendered. Can be a [[StaticMesh (Component)|StaticMesh]] or a [[:Category:Components:Assets:Procedural Meshes|Procedural Mesh]]
|Materials|Material| A list of materials to be applied to the mesh
|Materials|{{RootFieldType|SyncAssetList`1|[[Type:Material|Material]]}}|TypeAdv1=true| A list of materials to be applied to the mesh
|MaterialPropertyBlocks|MaterialPropertyBlock|  
|MaterialPropertyBlocks|{{RootFieldType|SyncAssetList`1|[[Type:MaterialPropertyBlock|MaterialPropertyBlock]]}}|TypeAdv2=true| A list of material property blocks to apply to the materials on this mesh. Usually used for performance reasons where using multiple similar materials would take more resources.
|ShadowCastMode|ShadowCastMode| How this object will cast shadows onto the world, or if it <i>only</i> draws a shadow.
|ShadowCastMode|ShadowCastMode| How this object will cast shadows onto the world, or if it <i>only</i> draws a shadow.
|SortingOrder|Int|  
|MotionVectorMode|MotionVectorMode| See Motion vector mode.
|SortingOrder|Int| Whether to render this before or after other renderers with geometry in the same location.
}}
}}


== Behavior == <!--T:3-->
== Sync Delegates ==
{{Table ComponentTriggers
|SplitSubmeshes:[[Type:Action|Action]]|[[Type:Action|Action]]|false| Will split this mesh into additional submeshes, each having only one material.
|MergeByMaterial:[[Type:Action|Action]]|[[Type:Action|Action]]|false| Will merge all submeshes that use the same material.
|SplitSubmeshes:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Called when the split submeshes button is touched.
|MergeByMaterial:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Called when the merge by material button is touched.
}}


=== Special Functions === <!--T:4-->
== Usage == <!--T:3-->


{| class="wikitable" style="font-size:10pt;"
! colspan="2" style="background: lightblue; font-size:10pt;" | Custom UI Elements
|- style="font-size:10pt; text-align:center; font-weight:bold;"
| Name
| Description
|-
| Split into separate meshes by material
| Will split this mesh into additional submeshes, each having only one material
|-
| Merge submeshes with same material
| Will merge all submeshes that use the same material
|}
== Examples == <!--T:2-->
== Examples == <!--T:2-->


== Related Components == <!--T:5-->
== See Also == <!--T:5-->
* [[Component:SkinnedMeshRenderer]]
</translate>
</translate>
[[Category:Components{{#translation:}}|MeshRenderer (Component){{#translation:}}]]
[[Category:Components{{#translation:}}|Mesh Renderer]]
[[Category:Components:Rendering{{#translation:}}|MeshRenderer (Component){{#translation:}}]]
[[Category:Components:Rendering{{#translation:}}|Mesh Renderer]]
[[Category:Renderer]]
[[Category:Renderer]]

Latest revision as of 20:38, 7 April 2025

Component image 
MeshRenderer component as seen in the Scene Inspector

The MeshRenderer component is used for rendering static 3D meshes in the world, and applying materials to that mesh.

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled. Some components stop their functionality when this field is disabled, but some don't.
Mesh Mesh The mesh to be rendered. Can be a StaticMesh or a Procedural Mesh
Materials list of Material A list of materials to be applied to the mesh
MaterialPropertyBlocks list of MaterialPropertyBlock A list of material property blocks to apply to the materials on this mesh. Usually used for performance reasons where using multiple similar materials would take more resources.
ShadowCastMode ShadowCastMode How this object will cast shadows onto the world, or if it only draws a shadow.
MotionVectorMode MotionVectorMode See Motion vector mode.
SortingOrder Int Whether to render this before or after other renderers with geometry in the same location.

Sync Delegates

Triggers
Method Name Method type and Arguments. Is the method hidden? Description
SplitSubmeshes:Action Action X Will split this mesh into additional submeshes, each having only one material.
MergeByMaterial:Action Action X Will merge all submeshes that use the same material.
SplitSubmeshes:ButtonEventHandler ButtonEventHandler Called when the split submeshes button is touched.
MergeByMaterial:ButtonEventHandler ButtonEventHandler Called when the merge by material button is touched.

Usage

Examples

See Also