Search Results for

    Show / Hide Table of Contents

    Class NameMapper

    Provides a mechanism for generating custom 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).

    Inheritance
    object
    Object
    ScriptableObject
    NameMapper
    Namespace: TriLibCore.Mappers
    Assembly: TriLibCore.Source.dll
    Syntax
    public class NameMapper : ScriptableObject

    Methods

    Map(AssetLoaderContext, ModelNamingData, IModel, string)

    Generates a custom name for the loaded 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 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 GameObject name. If null, the default TriLib naming will be used instead.

    Remarks

    Returning null indicates that the default TriLib naming pattern should be used. Otherwise, the returned string is applied directly as the GameObject name.

    Extension Methods

    IObjectExtensions.TryToDispose<T>(object)
    In this article
    Back to top TriLib documentation