cancel
Showing results for 
Search instead for 
Did you mean: 

Cloud Storage V2: How do i use it in Unity?

paultapper
Level 2

Hi

I want to use Cloud Storage 2 for my Oculus Quest 2 Unity game.  I have read https://developer.oculus.com/documentation/unity/ps-cloud-storage/?locale=en_GB but I can't figure out how to use Platform.CloudStorage2.GetUserDirectoryPath()

 

I want to get a string which is the path of the directory for me to save my game data into for it to be Cloud Sync'ed, but GetUserDirectoryPath() returns a "Request<string>" and I don't know how to get the string from that.

 

Please could anyone help?

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions

sSvvSs
Level 2

I think you need to use it like that:

Platform.CloudStorage2.GetUserDirectoryPath().OnComplete(res=> {
	if (res.IsError) {
		Debug.LogError(res.GetError().Message);
	} else {
		Debug.LogError(res.GetString());
	}
});

res.GetString() should contain path that you need, but I can't test it for sure, because I'm getting another error right now 😞

View solution in original post

2 REPLIES 2

sSvvSs
Level 2

I think you need to use it like that:

Platform.CloudStorage2.GetUserDirectoryPath().OnComplete(res=> {
	if (res.IsError) {
		Debug.LogError(res.GetError().Message);
	} else {
		Debug.LogError(res.GetString());
	}
});

res.GetString() should contain path that you need, but I can't test it for sure, because I'm getting another error right now 😞

View solution in original post

paultapper
Level 2

Thanks very much - that got GetUserDirectoryPath working for me (once I also allowed for its async nature).

 

In case its ever helpful to anyone else, for me it returned "/storage/emulated/0/Android/data/com.MyCoolCompany.MyAwesomeGame/files/cloud/data".

 

I've used that to now save my save data into what I think should be the correct place (and I can see it there using Explorer from my Windows development machine).  Unfortunately though, on the in-Oculus Apps display my app now always shows as "Syncing", and I don't see anything appear on the Cloud Storage page of the online Oculus Developer App Dashboard, which I was expecting to, so I think there must be something else I'm meant to do to get this working 😞