mdsn GetFiles function doesnt want to compile.

this works:

var path1 = System.IO.Directory.GetFiles(Application.dataPath, "c*");

And this doesnt compile, no function match:

var path1 = System.IO.Directory.GetFiles(Application.dataPath, "c*", SearchOption.AllDirectories);

in ,js they should both work, should i send a bugreport to bugs@unity3d. c0m?

No appropriate version of ‘System.IO.Directory.GetFiles’ for the argument list ‘(String, String, System.IO.SearchOption)’ was found.

You’ve forgotten to import System.IO.

No i have import System.IO at the top of the .js

That’s why GetFiles(String, String); works and Getfiles(String, String, SearchOption) didnt work.

If one Getfiles commands runs, the other should, but it doesn’t. I have .net framework 4.0 and the directory commands exist since version 2.0.

Unity doesn’t use .NET, so whatever framework you have installed isn’t relevant. I expect you have the platform set to webplayer, which doesn’t work with System.IO stuff for security reasons.

–Eric

Do you think that they expressly barred the use of Getfiles .AllSubDirectories because they were worried that someone could gain access to user’s documents by sending out a package with a getfiles to retrieve any document files from a computer?

That’s very right of them however the other directory commands should be barred as well.

Because, why would the compiler recognize one System.IO function in my script and not another one.

Indeed i get confused about .net implementation in unity, it’s written .net 2.0 at the bottom of player settings. (the PC/MAC/Linux of player can’t compile it.

None of the System.IO commands will actually work in a webplayer; they’ve expressly barred everything. Not sure about what compiles or not though. Unity uses Mono rather than .NET.

–Eric

Thanks!!! i found it, build settings, switch platform.

what you say is written on the functions list page for mono,