'I have a Unity WebGL game uploaded. Is it possible to manually create a persistent directory in /idbfs inside IndexedDB?
In the Unity project, I attached a script in an empty game object, and the code is demonstrated below: Is it possible to create a persistent directory myself?
public class TestScript : MonoBehaviour
{
private void Start()
{
GetDefaultDirectory();
CreateCustomDirectory();
}
// It returns "idbfs/" following with a random hash, such as "66ae5aa9b53f4a794ca331d30d2cb976".
public void GetDefaultDirectory()
{
Debug.Log(Application.persistentDataPath);
}
// Manually create a directory
// This can be created but will be flushed away after the page is reloaded.
public void CreateCustomDirectory()
{
#if UNITY_WEBGL
Directory.CreateDirectory("idbfs/abcdef");
#endif
}
}
And here's what the IndexedDB looks like. Only a random hash is shown here and my custom directory "idbfs/abcdef" won't be shown. But it did exist as I checked using Debug.Log.
Solution 1:[1]
In WebGL the path is passed through md5, that's why you can't recognize your directory name.
Here is the doc
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | rever |