Class GameObjectExport
Creates glTF files from GameObject hierarchies
Inherited Members
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 |