Class ByNameRootBoneMapper
Implements a root bone selection strategy by searching for a matching bone name within the loaded model’s hierarchy. This mapper iterates over a predefined list of candidate root bone names (e.g., "Hips", "Bip01", "Pelvis") and returns the first match found based on the configured string comparison settings.
Inherited Members
Namespace: TriLibCore.Mappers
Assembly: Assembly-CSharp.dll
Syntax
[CreateAssetMenu(menuName = "TriLib/Mappers/Root Bone/By Name Root Bone Mapper", fileName = "ByNameRootBoneMapper")]
public class ByNameRootBoneMapper : RootBoneMapper
Fields
CaseInsensitive
Indicates whether the string comparisons for matching root bone names should be case insensitive.
Declaration
public bool CaseInsensitive
Field Value
Type | Description |
---|---|
bool |
RootBoneNames
A list of candidate root bone names to search for in the loaded model. Examples might include "Hips", "Bip01", and "Pelvis".
Declaration
public string[] RootBoneNames
Field Value
Type | Description |
---|---|
string[] |
StringComparisonMode
Specifies the string comparison mode for matching loaded GameObject names against the candidate root bone names.
Declaration
[Header("Left = Loaded GameObjects Names, Right = Names in RootBoneNames")]
public StringComparisonMode StringComparisonMode
Field Value
Type | Description |
---|---|
StringComparisonMode |
Remarks
The "left" value is the name of the loaded GameObject and the "right" value is one of the candidate names specified in RootBoneNames.
Methods
Map(AssetLoaderContext, IList<Transform>)
Declaration
public override Transform Map(AssetLoaderContext assetLoaderContext, IList<Transform> bones)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The context used for loading the model, containing references and additional settings. |
IList<Transform> | bones | A list of candidate bone transforms extracted from the loaded model's hierarchy. |
Returns
Type | Description |
---|---|
Transform | The UnityEngine.Transform corresponding to the matched root bone name, or if no match is found, the result of the base implementation. |
Overrides
Remarks
This method iterates over the RootBoneNames array and, for each candidate name,
calls FindDeepChild(IList<Transform>, string) to determine if any of the provided
bones
have a name that matches (according to the specified string comparison mode).
If a match is found, that UnityEngine.Transform is immediately returned. If no candidate matches,
the base mapper's implementation is used as a fallback.