Class GameObjectExport
Creates glTF files from GameObject hierarchies
Inherited Members
Namespace: GLTFast.Export
Assembly: solution.dll
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 (<see cref="IDeferAgent"/>); decides when/if to preempt export to preserve a stable frame rate. |
ICodeLogger | logger | Interface for logging (error) messages. |
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 |
---|---|
bool | 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 Task<bool> SaveToFileAndDispose(string path, CancellationToken cancellationToken = default)
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<bool> | 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 Task<bool> SaveToStreamAndDispose(Stream stream, CancellationToken cancellationToken = default)
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<bool> | True if the glTF file was written successfully, false otherwise |