The '''SkinnedMeshRenderer''' component is used for rendering animated/dynamic 3D meshes in the world, and applying materials to that mesh.
The '''SkinnedMeshRenderer''' component is used for rendering animated/dynamic 3D meshes in the world, and applying materials to that mesh.
== Usage == <!--T:2-->
== Fields == <!--T:2-->
{{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.
|BoundsComputeMethod|SkinnedBounds| How the bounds of this mesh will be calculated. Should be left as ''Static'' if possible, for performance reasons.
|BoundsComputeMethod|SkinnedBounds| How the bounds of this mesh will be calculated. Should be left as ''Static'' if possible, for performance reasons.
|ProxyBoundsSource|SkinnedMeshRenderer|
|ProxyBoundsSource|'''[[Component:SkinnedMeshRenderer|SkinnedMeshRenderer]]'''|TypeAdv7=true| A [[Component:SkinnedMeshRenderer|SkinnedMeshRenderer]] to use the <code>ExplicitLocalBounds</code> of rather than the <code>ExplicitLocalBounds</code> on this component.
|Bones|Slot| ''Automatically Assigned'' — List of bones present in this mesh
|ExplicitLocalBounds|BoundingBox| A box that within view will render the mesh, and when out of view will cull the mesh and stop rendering it. Is used when <code>ProxyBoundsSource</code> is null.
|BlendShapeWeights|Float| ''Automatically Assigned'' — List of blendshapes present in this mesh, and their respective weights.
|Bones|{{RootFieldType|SyncRefList`1|[[Type:Slot|Slot]]}}|TypeAdv9=true| ''Automatically Assigned'' — List of bones present in this mesh
|BlendShapeWeights|{{RootFieldType|SyncFieldList`1|[[Type:Float|Float]]}}|TypeAdv10=true| ''Automatically Assigned'' — List of blendshapes present in this mesh, and their respective weights.
}}
}}
== Behavior ==
=== Sync Delegates === <!--T:4-->
<!--T:5-->
{{Table ComponentTriggers
|SplitBlenshapeAlongAxis:[[Type:Func`7|Func`7]]<[[Type:Int|Int]], [[Type:Axis3D|Axis3D]], [[Type:Float|Float]], [[Type:Float|Float]], [[Type:String|String]], [[Type:String|String]], [[Type:Task`1|Task`1]]<[[Type:Bool|Bool]]>>|[[Type:Func`7|Func`7]]<[[Type:Int|Int]], [[Type:Axis3D|Axis3D]], [[Type:Float|Float]], [[Type:Float|Float]], [[Type:String|String]], [[Type:String|String]], [[Type:Task`1|Task`1]]<[[Type:Bool|Bool]]>>|false| Splits a blendshape along a given axis, and returns a task representing if the operation is done yet.
|BakeBlendshape:[[Type:Func`2|Func`2]]<[[Type:Int|Int]], [[Type:Task`1|Task`1]]<[[Type:Bool|Bool]]>>|[[Type:Func`2|Func`2]]<[[Type:Int|Int]], [[Type:Task`1|Task`1]]<[[Type:Bool|Bool]]>>|false| bakes a blendshape to make it part of the mesh rest state, and returns a task representing if the operation is done yet.
|RemoveBlendshape:[[Type:Func`2|Func`2]]<[[Type:Int|Int]], [[Type:Task`1|Task`1]]<[[Type:Bool|Bool]]>>|[[Type:Func`2|Func`2]]<[[Type:Int|Int]], [[Type:Task`1|Task`1]]<[[Type:Bool|Bool]]>>|false| removes a blendshape from the mesh, and returns a task representing if the operation is done yet.
|VisualizeApproximateBoneBounds:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Makes a series of boxes showing the bounds of the bones in the mesh.
|VisualizeBoneBounds:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Makes a series of boxes showing the bounds of the bones in the mesh.
|SeparateOutBlendshapes:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Separates out the blendshape affected mesh parts from the non blendshape affected mesh parts.
|StripEmptyBlendshapes:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Removes blendshapes that don't change anything.
|BakeNonDrivenBlendshapes:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Bakes all blendshapes on the mesh that aren't driven based on their current value, making it part of the rest state.
|BakeToStaticMesh:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Bakes the mesh and makes it a static mesh instead.
|MergeBlendshapes:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true|Combine all blendshapes in to one blendshape, which interpolates between the source blendshapes like a playback timeline.
|StripEmptyBones:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Gets rid of bones that have no vertices assigned to them.
|ComputeExplicitBoundsFromPose:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Computes the explicit bounds property for the skinned mesh renderer component based on it's current pose of it's bones.
|ExtendExplicitBoundsFromPose:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| extends the bounds of the explicit bounds property for the skinned mesh renderer component based on it's current pose of it's bones.
|SortBlendshapesByName:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Sorts blendshapes by name in alphabetical order.
|SortBlendshapesByNameLength:[[Type:ButtonEventHandler|ButtonEventHandler]]|[[Type:ButtonEventHandler|ButtonEventHandler]]|true| Sorts blendshapes by how many characters are in a given blendshape name.
|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
}}
== Usage ==
<!--T:3-->
<!--T:3-->
While it ''can'' be used for rendering static meshes, it is '''not recommended''' as there is a slight performance penalty for using SkinnedMeshRenderer, even if the animation features aren't used — Please try to use [[MeshRenderer (Component)| MeshRenderer]] where possible.
While it ''can'' be used for rendering static meshes, it is '''not recommended''' as there is a slight performance penalty for using SkinnedMeshRenderer, even if the animation features aren't used — Please try to use [[MeshRenderer (Component)| MeshRenderer]] where possible.
=== Special Functions === <!--T:4-->
== Examples == <!--T:6-->
<!--T:5-->
== See Also == <!--T:7-->
{| class="wikitable" style="font-size:10pt;"
* [[Type:IRenderable]]
! colspan="2" style="background: lightblue; font-size:10pt;" | Custom UI Elements
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.
Will merge all submeshes that use the same material
Usage
While it can be used for rendering static meshes, it is not recommended as there is a slight performance penalty for using SkinnedMeshRenderer, even if the animation features aren't used — Please try to use MeshRenderer where possible.