Ask Your Question
1

Is it possible to access and update data on the internal storage of Oculus Go using Unity?

asked 2022-04-28 11:00:00 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-09-18 13:00:00 +0000

lalupa gravatar image

Yes, it is possible to access and update data on the internal storage of Oculus Go using Unity. You can use the Unity's File API to read and write data to the internal storage. However, you need to request permission from the user to access the internal storage using Android's permission system.

Here is an example of reading and writing a file on Oculus Go's internal storage using Unity:

// Request permission to access the internal storage
yield return Application.RequestUserAuthorization(UserAuthorization.ExternalStorageWrite);

if (Application.HasUserAuthorization(UserAuthorization.ExternalStorageWrite))
{
    // Path to the file on the internal storage
    string filePath = Path.Combine(Application.persistentDataPath, "example.txt");

    // Write data to the file
    File.WriteAllText(filePath, "Hello, World!");

    // Read data from the file
    string data = File.ReadAllText(filePath);
    Debug.Log("Data read from file: " + data);
}
else
{
    Debug.LogError("Unable to access internal storage.");
}

Note that when running the application on the Oculus Go, you need to build your application with the Android SDK and set up the Oculus Go developer mode to install and run your application on the device.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-04-28 11:00:00 +0000

Seen: 9 times

Last updated: Sep 18 '21