docs.unity3d.com
    Show / Hide Table of Contents

    Class GameObjectExport

    Creates glTF files from GameObject hierarchies

    Inheritance
    Object
    GameObjectExport
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: GLTFast.Export
    Syntax
    public class GameObjectExport

    Constructors

    GameObjectExport(ExportSettings, GameObjectExportSettings, IMaterialExport, IDeferAgent, ICodeLogger)

    Provides glTF export of GameObject based scenes and hierarchies.

    Declaration
    public GameObjectExport(ExportSettings exportSettings = null, GameObjectExportSettings gameObjectExportSettings = null, IMaterialExport materialExport = null, IDeferAgent deferAgent = null, ICodeLogger logger = null)
    Parameters
    Type Name Description
    ExportSettings exportSettings

    Export settings

    GameObjectExportSettings gameObjectExportSettings

    GameObject export settings

    IMaterialExport materialExport

    Provides material conversion

    IDeferAgent deferAgent

    Defer agent; decides when/if to preempt export to preserve a stable frame rate IDeferAgent

    ICodeLogger logger

    Interface for logging (error) messages ConsoleLogger

    Methods

    AddScene(GameObject[], String)

    Adds a scene to the glTF. If the conversion to glTF was not flawless (i.e. parts of the scene were not converted 100% correctly) you still might be able to export a glTF. You may use the CollectingLogger to analyze what exactly went wrong.

    Declaration
    public bool AddScene(GameObject[] gameObjects, string name = null)
    Parameters
    Type Name Description
    GameObject[] gameObjects

    Root level GameObjects (will get added recursively)

    String name

    Name of the scene

    Returns
    Type Description
    Boolean

    True if the scene was added flawlessly, false otherwise

    SaveToFileAndDispose(String, CancellationToken)

    Exports the collected scenes/content as glTF, writes it to a file and disposes this object. After the export this instance cannot be re-used!

    Declaration
    public async Task<bool> SaveToFileAndDispose(string path, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    String path

    glTF destination file path

    CancellationToken cancellationToken

    Token to submit cancellation requests. The default value is None.

    Returns
    Type Description
    Task<Boolean>

    True if the glTF file was created successfully, false otherwise

    SaveToStreamAndDispose(Stream, CancellationToken)

    Exports the collected scenes/content as glTF, writes it to a Stream and disposes this object. Only works for self-contained glTF-Binary. After the export this instance cannot be re-used!

    Declaration
    public async Task<bool> SaveToStreamAndDispose(Stream stream, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    Stream stream

    glTF destination stream

    CancellationToken cancellationToken

    Token to submit cancellation requests. The default value is None.

    Returns
    Type Description
    Task<Boolean>

    True if the glTF file was written successfully, false otherwise

    Back to top
    Terms of use
    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