Skip to content

System IO Exception in ExperimentProfileSelector.Populate on Android #175

Open
@fthiemer

Description

@fthiemer

TL;DR: The ExperimentProfileSelector.Populate method tries to write to Application.streamingAssetsPath, which is readOnly, and uses System.IO for it which does not work on Android. Will this be fixed in the future and if not how could I contribute a fix in the future?

Details:
I am using UXF for a Unity 6 Standalone VR Project on the Meta Quest 2.

After building, the build logs the following error via logcat:

2025.02.11 17:08:22.239 29180 29214 Error Unity IOException: Read-only file system
2025.02.11 17:08:22.239 29180 29214 Error Unity at System.IO.FileSystem.CreateDirectory (System.String fullPath) [0x00000] in <00000000000000000000000000000000>:0
2025.02.11 17:08:22.239 29180 29214 Error Unity at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <00000000000000000000000000000000>:0
2025.02.11 17:08:22.239 29180 29214 Error Unity at UXF.UI.ExperimentProfileSelector.Populate (System.Boolean retry) [0x00000] in <00000000000000000000000000000000>:0

This traces back to the ExperimentProfileSelector class, which tries to write to that location, even though the documentation states: "The streamingAssets path is read-only. Don’t modify or write new files to the streamingAssets directory at runtime." It seems to work in the editor though.

It also mentions that android builds can only access that location via webrequest:
"You cannot use synchronous filesystem APIs, such as the C# System.IO.File class, to access the StreamingAssets folder on the WebGL and Android platforms. No file access is available on WebGL. Android uses a compressed .apk file. These platforms return a URL. Use the UnityWebRequest class to access the assets."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions