Documentation

Unity Engine

Download Unity

Unity Engine

FindBoneIndex(StringHash)

Finds the index of the bone with an identifier.
Read time 1 minuteLast updated 4 hours ago

Definition

public int FindBoneIndex(StringHash id)

Parameters

The
StringHash
identifier of the bone to find.

Returns

Type

Description

intThe index of the bone in Skeleton.Ids. If no bone has the identifier, returns
-1
.

Remarks

For a rig built from transforms or an Avatar, the identifier of a bone is the StringHash of its path relative to the root. For example,
FindBoneIndex(new StringHash("Hips/Spine"))
finds the bone at that path. The method searches the bones linearly. For details, refer to BindingUtility.FindBindingIndex.