Cloud Storage 2

Note: You are viewing the Unity version of this topic. To view this topic for native development, see Cloud Storage 2 (Native). To view this topic for Unreal development, see Cloud Storage 2 (Unreal).

Cloud Storage v2 enables you to save, synchronize, and load data between devices and installs from your Oculus apps. When you enable Cloud Storage v2, a local default directory is synchronized to/from the cloud at app startup and exit for each app or app grouping. You can also choose to selectively synchronize files or directories relative to the default location by specifying Selective Sync paths.

Cloud Storage 2 supports the following use-cases, and more:

  • Save progress between app uses and installs. Users are able to uninstall and re-install without losing their saved data.
  • Share progress between devices. Users can sync data between devices.
  • Provide disaster recovery. User data can be restored if devices are lost or damaged, or if the local data is corrupted.

Cloud Storage 2 replaces the cloud storage feature that was supported only for Rift apps. If you need docs for this legacy feature, see Cloud Storage (legacy).

Data Use Checkup

Note that this feature accesses user data and may require you to complete the Data Use Checkup form prior to submitting your app to the Oculus Store. For more information, see Complete a Data Use Checkup.

Cloud Storage 2 Quick Reference

Following is a summary of the features and requirements for Cloud Storage 2:

  • Permissions: Because the default location is external storage, Android apps that use Cloud Storage v2 will require WRITE_EXTERNAL_STORAGE permissions. For more information, see the Permissions Overview and WRITE_EXTERNAL_STORAGE in the Android documentation.

    Note: On Android, the WRITE_EXTERNAL_STORAGE permission is no longer required as of version 19 of the Oculus software.

  • Conflict resolution: At app launch time, if there is a file conflict between the cloud and the local device, the user will be prompted to choose either the device data or the cloud data, or they can choose to cancel the application launch.
  • Path and Filename Limits: To be compatible with all platforms, you must limit the filename length to 260 characters, and file names to 255 characters.
  • File types: You can store any file type using cloud storage.
  • File number/size: You can synchronize 100 files, each up to 10 MB in size per app or app grouping.
  • Selective Syncing: You can optionally specify certain folders and/or files to sync. Selective sync file paths must start with a forward slash and can contain wildcard characters (*) in the directory or file name or file extension. Other special characters and some file names are not allowed. See Selective Sync for detailed requirements.
  • Get local storage location in code: Use the Platform.CloudStorage2.GetUserDirectoryPath() method to get the directory where files are saved on the user device.

Enable Clouds Saves in the Developer Dashboard

To use Cloud Storage v2, you must explicitly enable it in the developer dashboard.

  • Sign in to the Oculus developer portal.
  • Under your org, find your app, or app grouping and navigate to Platform Services. Note that if you are enabling Cloud Storage v2 for an app grouping.
  • Select Cloud Storage.
  • On the Cloud Storage page, click Enable Cloud Storage 2 and choose Enable.

The following image shows an example:

Cloud Storage 2 - Dashboard
Now, files will be synced to the cloud from the default directory on the user device.

Note that for platform compatibility reasons, files with the following names will not sync to the cloud: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, LPT0. For more information, see Windows Desktop - Naming a File.

Selective Sync

You can optionally synchronize a subset of files or directories relative to the default directory by configuring selective sync paths.

To configure a path

Under Selective Sync, click Add new path.

Note: If you don’t see the option to configure a sync location, make sure you saved after enabling the Cloud Storage v2 option.

  • Enter a path. The path:
    • Must start with a forward slash.
    • Can contain one set of wildcard characters (**) in the directory name
    • Can contain multiple wildcard characters (*) for the file name and extension.
    • Can’t contain any other special characters (\ : ? “ < > | & ) or the path will be ignored.
    • Can’t be longer than 260 characters. An individual file name must not exceed 255 characters.

    For example, /scores/*.dat is a valid selective sync path.

  • Click Submit

To Modify or Delete a Selective Sync Path

You can easily modify or delete a selective sync path in the developer dashboard.

  • In the developer dashboard, find your app or app grouping and go to Cloud Storage.
  • On the Cloud Storage page, under Cloud Storage v2, find the path you want to modify in the Selective Sync table.
  • Click the ellipses (...) button in that row and select Edit or Delete
  • Click Submit after you finish editing the path or to confirm the deletion.

Access the Device Sync Location in Code

Once you have enabled cloud storage, the default device directory or selective sync files/directory will automatically be synced when the user starts or exits your app.

  1. To, retrieve the device save location, call the Platform.CloudStorage2.GetUserDirectoryPath() method.

  2. Then, parse the result of this call using the Message_GetString method.

This will return a string that indicates the default storage location for that user on that device. Selective sync paths will be relative to this directory. Use this path to write or retrieve local data that is synced with cloud storage.

Exit App Correctly

You must correctly exit the app for files to sync to the cloud correctly. When you develop Oculus mobile apps using Unity, make sure to use the OVRManager.PlatformUIConfirmQuit method to quit the app.

Test Cloud Storage v2

The Cloud File List section of the Cloud Saves page in the developer dashboard enables you to test cloud saves when you run apps associated with your developer account. Files that are synchronizing when you run your app will appear in the section. If they don’t appear as expected, you may have an issue with the path you specified.