Interface IAssetGenerator | Asset Graph | 1.6.0-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Interface IAssetGenerator

    IAssetGenerator is an interface to generate new asset from incoming asset. Subclass of IAssetGenerator must have CustomAssetGenerator attribute.

    Namespace: UnityEngine.AssetGraph
    Syntax
    public interface IAssetGenerator

    Methods

    CanGenerateAsset(AssetReference)

    Test if generator can generate new asset with given asset. NodeException should be thrown if there is any error that user should know about.

    Declaration
    bool CanGenerateAsset(AssetReference asset)
    Parameters
    Type Name Description
    AssetReference asset

    Asset to examine if derivertive asset can be generated.

    Returns
    Type Description
    Boolean

    true if this instance can generate asset; otherwise, false.

    GenerateAsset(AssetReference, String)

    Generates the asset.

    Declaration
    bool GenerateAsset(AssetReference asset, string generateAssetPath)
    Parameters
    Type Name Description
    AssetReference asset

    Asset to generate derivertive asset from.

    String generateAssetPath

    Path to save generated derivertive asset.

    Returns
    Type Description
    Boolean

    true, if asset was generated, false otherwise.

    GetAssetExtension(AssetReference)

    Gets the asset extension of generating asset.

    Declaration
    string GetAssetExtension(AssetReference asset)
    Parameters
    Type Name Description
    AssetReference asset

    The source asset to generate from.

    Returns
    Type Description
    String

    The extension in string format (e.g. ".png").

    GetAssetType(AssetReference)

    Gets the type of the asset. For type of assets that have associated importers, return type of Importer. Textures = TextureImporter, Audio = AudioImporter, Video = VideoClipImporter

    Declaration
    Type GetAssetType(AssetReference asset)
    Parameters
    Type Name Description
    AssetReference asset

    The source asset to generate from.

    Returns
    Type Description
    Type

    The asset type.

    OnInspectorGUI(Action)

    Draw Inspector GUI for this AssetGenerator. Make sure to call onValueChanged() when inspector values are modified. It will save state of AssetGenerator object.

    Declaration
    void OnInspectorGUI(Action onValueChanged)
    Parameters
    Type Name Description
    Action onValueChanged

    Action to call when inspector value changed.

    OnValidate()

    Called when validating this prefabBuilder. NodeException should be thrown if this modifier is not ready to be used for building.

    Declaration
    void OnValidate()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023