CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
File access
This section describes the file access in Android.
Accessible storage

The CRIWARE Unity Plugin can access the StreamingAssets directory.
To build a Unity project for Android, you can also access other local storage.
The following shows accessible storage devices and relevant paths.

  • [SD card] "/sdcard/..."
  • [Package specific directory] "/data/data/<java style package name>/..."


The android.os.Environment class provides the get<Storage name>Directory method.
You can use this method to obtain a file instance in a different directory.
From the obtained File instance, you can get directory paths by using the getPath() method.
The CRIWARE Unity Plugin can access files under some paths obtained here.

To access a storage device shown above, you must provide its path to each method in the CriFsUtility class.


Maximum file size that can be handled by CRI library
CRI library for Android can access a file smaller than 2 GB.
If it accesses a file equal to or larger than 2 GB, it may cause a malfunction such as forced termination.

If a CPK file is equal to or larger than 2 GB, divide it into multiple CPK files smaller than 2 GB.

Attention
The file size limit in the assets folder depends on the version number of Android OS and the device model.
For example, according to a report about Toshiba Regza Tablet (OS 3.2), when a CPK file that was equal to or larger than 800 MB in the assets folder was bound,
the OS displayed an error message saying that it failed in creating a memory map for the file.
Note the upper limit of the virtual memory size for each application configured in the OS.
Note about file access with URL specification
When you use the file access with URL specification in the CRIWARE Unity Plugin, take note of the PlayerSettings in Unity Editor at build.
Before build, change the Internet Access value in the Per-Platform Settings to "Require".
If this value is "Auto," loading may fail.