Class NameMapper
Provides a mechanism for generating custom UnityEngine.GameObject names in the scene, based on metadata from the source 3D model. By inheriting NameMapper and overriding Map(AssetLoaderContext, ModelNamingData, IModel, string), users can implement specialized naming schemes (e.g., appending model part numbers, classes, or other identifiers).
Namespace: TriLibCore.Mappers
Assembly: TriLibCore.dll
Syntax
public class NameMapper : ScriptableObject
Constructors
NameMapper()
Declaration
public NameMapper()
Methods
Map(AssetLoaderContext, ModelNamingData, IModel, string)
Generates a custom name for the loaded UnityEngine.GameObject based on the provided model data.
If this method returns null
, TriLib will fall back to its default naming strategy.
Declaration
public virtual string Map(AssetLoaderContext assetLoaderContext, ModelNamingData data, IModel model, string readerName)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The AssetLoaderContext containing references to the model’s loading options, callbacks, and the root UnityEngine.GameObject structure. |
ModelNamingData | data | A ModelNamingData object containing fields such as original name, class, ID, and part number from the source file. |
IModel | model | The IModel representing a portion of the loaded hierarchy (e.g., a mesh segment or node). |
string | readerName | The name of the TriLib reader used to load the model data (e.g., “FBXReader”, “GltfReader”). |
Returns
Type | Description |
---|---|
string | A string representing the desired UnityEngine.GameObject name. If |
Remarks
Returning null
indicates that the default TriLib naming pattern should be used.
Otherwise, the returned string is applied directly as the UnityEngine.GameObject name.