- Home /
Duplicate Question - http://answers.unity3d.com/questions/1114720/systemiofile-does-not-contain-a-definition-for-rea-1.html (and many others)
one class (File) with different definitions in different projects
Hello,
I am working on a project, and I need to use the System.IO.File.CreateText(string path) function. I already used it in another project and it has been well detected. But in my new project, it says that "File does not contain a defintion for CreateText". Then I right click on "File" and "Go to definition", and it opens a file [from metadata] in which there is no "CreateText" function... But the problem is that in my other project, it opens another file in which does contain a definition for it ! (and lot of additionnal functions)
So how can I access this function from my new project ? Why do I get different definition files for the same class ?
(I use Microsoft Visual studio for the scripting)
Thanks in advance.
Answer by Dave-Carlile · Jun 09, 2016 at 03:25 PM
Check your build target. I believe WebGL might be the default, which doesn't support file IO operations.
Sorry for my duplicate question, I made some researchs, but it is not easy to find an existing topic since they are not about the same function...
And you're right: I forgot that I switched the platform to the webplayer... Thank you very much !
No worries, sometimes it's hard to know what to search for.
Follow this Question
Related Questions
Check if a class as been defined 0 Answers
Does Unity iPhone support calls to the GL Class? 2 Answers
WWW.Class and ASP.NET 1 Answer
Can I use generic objects as variables then cast them upon construction? 2 Answers
Questions about classes. 4 Answers