- Home /
Unity WebGL File.OpenRead adds a slash in front of the path
In my unity project I'm using the File.OpenRead methode to open a file. In Unity itself it's working fine but when I build & run it in WebGL the developer console say's that it can't find the path. The path I give for testing is just @"C:" but in the console it say's that it can't find the path "/C:". So why is it adding a slash in front of the path out of nowhere? I'm using Firefox 55.0.3 (64-Bit).
using (FileStream file = File.OpenRead(@"C:"))
{
unityScene = Serializer.Deserialize<GameScene>(file);
}
In the console there is that line.
FileNotFoundException: Could not find file "/C:".
Thanks in advance!
Answer by Vaitaliy · Oct 06, 2020 at 08:22 AM
Same problem. Even on the server it tries to load "/https://..."
Your answer
Follow this Question
Related Questions
iPhone System.IO.File.Exists() not working 1 Answer
[SOLVED] Bad PKCS7 While encrypting a file 1 Answer
Is accessing user documents folder possible on Unity3D? 0 Answers
CaptureScreenshot writing to Phone, but persistentdatapath linking to the external card. 0 Answers
Resources Load to open pdf is not working anymore in Android 7 0 Answers