- Home /
`System.IO.File' does not contain a definition for `ReadAllBytes'?
I have no clue what happened but all of a sudden I get this error that says: System.IO.File' does not contain a definition for
ReadAllBytes'
I don't know why the unity engine is freaking out about this error, but monodevelop is not getting the error and is instead showing the documentation as if it was working. And this is preventing me from playing the editor in play-mode because it counts as a compiler error.
tex.LoadImage(File.ReadAllBytes(imageFiles[i]));
I even have the namespace:
using System.IO;
What am I doing wrong here? What could have happened that is causing this? It was working before, but now it thinks it is broken.
Answer by AmasterAmaster · Aug 02, 2015 at 07:40 AM
Ok, Facepalmed myself and someone mentioned that it will generate the error when the build settings are for the web player and not for the standalone build. Sorry for posting this, but now I know what the problem is and the solution as well. I will keep this archived to remind myself if it happens again.
Don't be sorry. It's fail of Unity bug reporter. It can catch that you want to call not-allowed method but it report it as non-existing. This is confusing.