Class GltfAsset
Base component for code-less loading of glTF files
Inherited Members
Namespace: GLTFast
Syntax
public class GltfAsset : GltfAssetBase
Properties
FullUrl
Final URL, considering all options (like GLTFast.GltfAsset.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 |
---|---|
Boolean |
PlayAutomatically
If true, the first animation clip starts playing right after instantiation.
Declaration
public bool PlayAutomatically { get; }
Property Value
Type | Description |
---|---|
Boolean |
SceneId
Scene to load (-1 loads glTFs default scene)
Declaration
protected int SceneId { get; }
Property Value
Type | Description |
---|---|
Int32 |
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 |
---|---|
Boolean |
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 async 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<Boolean> | Async Task that loads the glTF's contents |
Overrides
PostInstantiation(IInstantiator, Boolean)
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 |
Boolean | success | True if instantiation was successful, false otherwise |
Overrides
Start()
Called at initialization phase
Declaration
protected virtual async void Start()