OnDemandResourcesRequest
class in
UnityEngine.iOS
/
Inherits from:AsyncOperation
Suggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSubmission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Close Description
Represents a request for On Demand Resources (ODR). It's an AsyncOperation and can be yielded in a coroutine.
no example available in JavaScript
using UnityEngine;
using UnityEngine.iOS;
using System;
using System.Collections;
public static class Loader
{
public static IEnumerator LoadAsset(string resourceName)
{
// Create the request
var request = OnDemandResources.PreloadAsync(new string[] { "Asset's ODR tag" });
// Wait until request is completed
yield return request;
// Check for errors
if (request.error != null)
throw new Exception("ODR request failed: " + request.error);
// Get path to the resource and use it
var path = request.GetResourcePath(resourceName);
Debug.Log(path);
// Call Dispose() when resource is no longer needed.
request.Dispose();
}
}
Public Methods
Dispose | Release all resources kept alive by On Demand Resources (ODR) request. |
GetResourcePath | Gets file system's path to the resource available in On Demand Resources (ODR) request. |
Inherited Members
Properties
allowSceneActivation | Allow scenes to be activated as soon as it is ready. |
isDone | Has the operation finished? (Read Only) |
priority | Priority lets you tweak in which order async operation calls will be performed. |
progress | What's the operation's progress. (Read Only) |
Events
completed | Event that is invoked upon operation completion. An event handler that is registered in the same frame as the call that creates it will be invoked next frame, even if the operation is able to complete synchronously. If a handler is registered after the operation has completed and has already invoked the complete event, the handler will be called synchronously. |