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>)
Finds a suitable root bone from a provided list of potential bone transforms. This is the highest-level bone in the hierarchy that others descend from. Subclasses should override this method to implement more advanced selection logic (e.g., checking naming patterns, evaluating bone connections, etc.).
Declaration
public override Transform Map(AssetLoaderContext assetLoaderContext, IList<Transform> bones)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The AssetLoaderContext referencing the loaded model’s GameObjects, user-defined import options, and callbacks. |
IList<Transform> | bones | An ordered or unordered list of transforms that may qualify as bones in the skeleton hierarchy. Subclasses can evaluate these to decide which one is truly at the top of the chain. |
Returns
Type | Description |
---|---|
Transform | The UnityEngine.Transform chosen to serve as the root bone. By default,
this method returns |