Fetching DLC download progress in Unity
Hi all,
I am trying to implement DLC download in Unity. These are my environment details: Unity: 2018.3.6f1, Oculus Integration 1.35.
I am able to get the list of DLC files that I've uploaded and also able to download them. However, I am not sure how to get the progress of the download. The documentation suggests subscribing to notifications. https://developer.oculus.com/documentation/platform/latest/concepts/dg-dlc/
Can anyone please share some sample code on how this can be done? I'll share what I have so far below.
I am trying to implement DLC download in Unity. These are my environment details: Unity: 2018.3.6f1, Oculus Integration 1.35.
I am able to get the list of DLC files that I've uploaded and also able to download them. However, I am not sure how to get the progress of the download. The documentation suggests subscribing to notifications. https://developer.oculus.com/documentation/platform/latest/concepts/dg-dlc/
Can anyone please share some sample code on how this can be done? I'll share what I have so far below.
Core.AsyncInitialize().OnComplete((Message InitMsg) =>
{
AssetFile.GetList().OnComplete((Message msg) =>
{
if (msg.IsError)
{
Debug.LogError("Error fetching DLC List: " + msg.GetError().Message);
}
else
{
var assetList = msg.GetAssetDetailsList();
foreach (var item in assetList)
{
Debug.Log("AssetID: " + item.AssetId);
Debug.Log("AssetType: " + item.AssetType);
Debug.Log("DownloadStatus: " + item.DownloadStatus);
Debug.Log("Filepath: " + item.Filepath);
//Download it
if (string.Equals(item.DownloadStatus, "available"))
{
AssetFile.DownloadById(item.AssetId).OnComplete((msg1) =>
{
if (msg1.IsError)
{
Debug.Log("Error downloading assetID: " + item.AssetId + " " + msg1.GetError().Message);
}
else
{
Debug.Log("Downloaded intiated at: " + msg1.GetAssetFileDownloadResult().Filepath);
var r = msg1.GetAssetFileDownloadUpdate();
}
});
}
else
{
Debug.Log("--------------------------------Asset ID: " + item.AssetId + " Status: " + item.DownloadStatus);
}
}
}
});
});
