Class GltfAsset
Base component for code-less loading of glTF files
Inherited Members
Namespace: GLTFast
Assembly: glTFast.dll
Syntax
public class GltfAsset : GltfAssetBase
Properties
FullUrl
Final URL, considering all options (like streamingAsset)
Declaration
public string FullUrl { get; }
Property Value
| Type | Description |
|---|---|
| string |
InstantiationSettings
Instantiation settings
Declaration
public InstantiationSettings InstantiationSettings { get; set; }
Property Value
| Type | Description |
|---|---|
| InstantiationSettings |
LoadOnStartup
Automatically load at start
Declaration
public bool LoadOnStartup { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
PlayAutomatically
If true, the first animation clip starts playing right after instantiation.
Declaration
public bool PlayAutomatically { get; }
Property Value
| Type | Description |
|---|---|
| bool |
SceneId
Scene to load (-1 loads glTFs default scene)
Declaration
protected int SceneId { get; }
Property Value
| Type | Description |
|---|---|
| int |
SceneInstance
Latest scene's instance.
Declaration
public GameObjectSceneInstance SceneInstance { get; protected set; }
Property Value
| Type | Description |
|---|---|
| GameObjectSceneInstance |
StreamingAsset
If true, url is treated as relative StreamingAssets path
Declaration
public bool StreamingAsset { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Url
URL to load the glTF from Loading local file paths works by prefixing them with "file://"
Declaration
public string Url { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
ClearScenes()
Removes previously instantiated scene(s)
Declaration
public override void ClearScenes()
Overrides
GetDefaultInstantiator(ICodeLogger)
Returns an instance of the default instantiator
Declaration
protected override IInstantiator GetDefaultInstantiator(ICodeLogger logger)
Parameters
| Type | Name | Description |
|---|---|---|
| ICodeLogger | logger | Custom logger to use with the instantiator |
Returns
| Type | Description |
|---|---|
| IInstantiator | Default instantiator instance |
Overrides
Load(string, IDownloadProvider, IDeferAgent, IMaterialGenerator, ICodeLogger)
Method for manual loading with custom IDownloadProvider and IDeferAgent.
Declaration
public override Task<bool> Load(string gltfUrl, IDownloadProvider downloadProvider = null, IDeferAgent deferAgent = null, IMaterialGenerator materialGenerator = null, ICodeLogger logger = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | gltfUrl | URL of the glTF file. |
| IDownloadProvider | downloadProvider | Download Provider for custom loading (e.g. caching or HTTP authorization) |
| IDeferAgent | deferAgent | Defer Agent takes care of interrupting the loading procedure in order to keep the frame rate responsive. |
| IMaterialGenerator | materialGenerator | Used to convert glTF materials to Material instances |
| ICodeLogger | logger | Used for message reporting |
Returns
| Type | Description |
|---|---|
| Task<bool> | Async Task that loads the glTF's contents |
Overrides
PostInstantiation(IInstantiator, bool)
Callback that is called after instantiation
Declaration
protected override void PostInstantiation(IInstantiator instantiator, bool success)
Parameters
| Type | Name | Description |
|---|---|---|
| IInstantiator | instantiator | instantiator that was used |
| bool | success | True if instantiation was successful, false otherwise |
Overrides
Start()
Called at initialization phase
Declaration
protected virtual void Start()