Functions - Asset Files¶
Related Oculus Platform documentation:
- https://developer.oculus.com/resources/add-ons/
- https://developer.oculus.com/documentation/native/ps-iap/
Signals¶
assetfile_download_update¶
About
This signal will be emitted periodically to track the progress of the download. Here's an example of the payload of the signal:
assetfile_download_update
Signal
gets emitted, the values may be 0
for total_bytes
and transferred_bytes
. You should wait/check until the Signal
has a payload with total_bytes
more than 0
if you intend to use this value to show a progress bar, for example.
assetfile_download_finished¶
About
This signal will be emitted once the asset file has finished downloading. It will have a String
with the asset file ID as a payload. Note that the assetfile_download_update
Signal
will be emitted one last time as well with completed
as true
.
Functions¶
assetfile_get_list¶
assetfile_get_list()
Requests a list of asset files associated with this app.
Returns: A GDOculusPlatformPromise
that will contain an Array
of Dictionaries
with information about each asset file. The promise will error if the request couldn't be fulfilled.
If the asset file is of type language_pack
, the "tag" key is supposed to conform to the BCP47 standard, but in reality it replaces the "-" with "_" so what should be en-US
ends up as en_US
.
Example response:
Asset file types:
Type | Description |
---|---|
default | The asset file is used to download extra content post-installation. |
store | The asset file should be shown in the Store. |
language_pack | The asset file is used to manage different languages and translation data, which can be downloaded post-installation. |
Asset file download status:
Type | Description |
---|---|
installed | The asset file is installed |
available | The asset file can be downloaded |
in-progress | The asset file is being downloaded or installed |
Asset file IAP status:
Type | Description |
---|---|
free | The asset file is free |
entitled | The user is entitled to the asset file |
not-entitled | The user is not entitled to the asset file |
Example
assetfile_status_by_id¶
assetfile_status_by_id(asset_id : String
)
Requests information about a single asset file by its ID.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the asset file. The promise will error if the request couldn't be fulfilled.
See the example response from assetfile_get_list to get an idea of the response. The only difference is that this function returns a single Dictionary
and assetfile_get_list
returns an Array
of Dictionaries
.
Example
assetfile_status_by_name¶
assetfile_status_by_name(asset_name : String
)
Requests information about a single asset file by its name.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the asset file. The promise will error if the request couldn't be fulfilled.
See the example response from assetfile_get_list to get an idea of the response. The only difference is that this function returns a single Dictionary
and assetfile_get_list
returns an Array
of Dictionaries
.
assetfile_download_by_id¶
assetfile_download_by_id(asset_id : String
)
Sends a request to download an asset file with the given ID. The download may take a few seconds to begin.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the request. The promise will error if the request couldn't be fulfilled.
Example response:
Note
The file_path
in the dictionary does not indicate that the asset has finished downloading, it just indicates where the asset will be/is being downloaded.
See the Signals section to know about useful signals to track the progress of the download.
Example
assetfile_download_by_name¶
assetfile_download_by_name(asset_name : String
)
Sends a request to download an asset file with the given name. The download may take a few seconds to begin.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the request. The promise will error if the request couldn't be fulfilled.
Please look at the response from assetfile_download_by_id - both this function and assetfile_download_by_id
return the same data and can be used interchangeably, apart from using an ID for the other function and a name for this one.
Example
assetfile_download_cancel_by_id¶
assetfile_download_cancel_by_id(asset_id : String
)
Sends a request to cancel a download of the asset file with the given ID.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the request. The promise will error if the request couldn't be fulfilled.
Example response:
Note
success
will be true
if the request was successful and false
otherwise.
Example
assetfile_download_cancel_by_name¶
assetfile_download_cancel_by_name(asset_name : String
)
Sends a request to cancel a download of the asset file with the given name.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the request. The promise will error if the request couldn't be fulfilled.
Take a look at the example response from assetfile_download_cancel_by_id because both that function and this one return the same data.
Example
assetfile_delete_by_id¶
assetfile_delete_by_id(asset_id : String
)
Sends a request to delete an asset file with the given ID.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the request. The promise will error if the request couldn't be fulfilled.
Example response:
Note
success
will be true
if the request was successful and false
otherwise.
assetfile_delete_by_name¶
assetfile_delete_by_name(asset_name : String
)
Sends a request to delete an asset file with the given name.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the request. The promise will error if the request couldn't be fulfilled.
Take a look at the example response from assetfile_delete_by_id because both that function and this one return the same data.