# BoneWeight

> Describes 4 skinning bone weights that affect a vertex in a mesh.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule
* **Implements:** [IEquatable\<BoneWeight>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public struct BoneWeight : IEquatable<BoneWeight>
```

## Remarks

Elements in this struct must be in descending order of weight value. The sum of all weight values must be 1. If a vertex is affected by fewer than 4 bones, each of the remaining weight values must be 0.

Note that this struct, and the associated [Mesh.boneWeights](/engine/6000.7/script-reference/unityengine/mesh/boneweights.md) and [Mesh.GetBoneWeights](/engine/6000.7/script-reference/unityengine/mesh/getboneweights.md) APIs, describe exactly 4 bone weights per vertex. The newer [BoneWeight1](/engine/6000.7/script-reference/unityengine/boneweight1.md) struct describes a single bone weight, and it can be used with the associated [Mesh.GetAllBoneWeights](/engine/6000.7/script-reference/unityengine/mesh/getallboneweights.md), [Mesh.SetBoneWeights](/engine/6000.7/script-reference/unityengine/mesh/setboneweights.md) and [Mesh.GetBonesPerVertex](/engine/6000.7/script-reference/unityengine/mesh/getbonespervertex.md) APIs to describe up to 255 bone weights per vertex. It is preferable to use [BoneWeight1](/engine/6000.7/script-reference/unityengine/boneweight1.md) and its associated APIs; they offer more flexibility, and might result in small performance benefits as Unity does not have to perform unnessary conversion operations.

Additional Resources: [Mesh.boneWeights](/engine/6000.7/script-reference/unityengine/mesh/boneweights.md), [Mesh.GetBoneWeights](/engine/6000.7/script-reference/unityengine/mesh/getboneweights.md), [Mesh.GetAllBoneWeights](/engine/6000.7/script-reference/unityengine/mesh/getallboneweights.md), [Mesh.SetBoneWeights](/engine/6000.7/script-reference/unityengine/mesh/setboneweights.md), [Mesh.GetBonesPerVertex](/engine/6000.7/script-reference/unityengine/mesh/getbonespervertex.md), [ModelImporter.maxBonesPerVertex](/engine/6000.7/script-reference/unityeditor/modelimporter/maxbonespervertex.md), [QualitySettings.skinWeights](/engine/6000.7/script-reference/unityengine/qualitysettings/skinweights.md), [SkinnedMeshRenderer.quality](/engine/6000.7/script-reference/unityengine/skinnedmeshrenderer/quality.md).

## Properties

| Property                                                                           | Description                      |
| ---------------------------------------------------------------------------------- | -------------------------------- |
| [boneIndex0](/engine/6000.7/script-reference/unityengine/boneweight/boneindex0.md) | Index of first bone.             |
| [boneIndex1](/engine/6000.7/script-reference/unityengine/boneweight/boneindex1.md) | Index of second bone.            |
| [boneIndex2](/engine/6000.7/script-reference/unityengine/boneweight/boneindex2.md) | Index of third bone.             |
| [boneIndex3](/engine/6000.7/script-reference/unityengine/boneweight/boneindex3.md) | Index of fourth bone.            |
| [weight0](/engine/6000.7/script-reference/unityengine/boneweight/weight0.md)       | Skinning weight for first bone.  |
| [weight1](/engine/6000.7/script-reference/unityengine/boneweight/weight1.md)       | Skinning weight for second bone. |
| [weight2](/engine/6000.7/script-reference/unityengine/boneweight/weight2.md)       | Skinning weight for third bone.  |
| [weight3](/engine/6000.7/script-reference/unityengine/boneweight/weight3.md)       | Skinning weight for fourth bone. |
