So here is the deal:
I am making smt like Paint app, and suddenly fall into problems with saving of drawing result in web-player.
i believe that it is possible to do with WWW class and some html / php (of course if server that hold web-player have some scripts to maintain it).
but idea is to make something like standalone application. i mean you just put web-player into /www folder of your server, and everything works perfect without any additional options adjusting\scripts.
so, my first step was using example provided by EncodeToPNG docs.
if i run it as standalone app everything is perfect, but if it is web-player build - it throws error: ‘WriteAllBytes’ is not a member of ‘System.IO.File’.
i found solution here and build web-player. but then when i am trying to save textures web-player gives error.
how to solve this problem without using server as a bump storage for textures?
i believe it can be done by WWW class, but i don’t know how, trying to solve it right now.
here is actual code of file save\creation
// Encoding
var bytes = tex.EncodeToPNG();
var PathToTexture : String = FilePath +"/" + NameOfGameObject + ".png";
// saving to hard drive
var fs : FileStream = FileStream(PathToTexture, FileMode.CreateNew);
var w : BinaryWriter = BinaryWriter(fs);
w.Write(bytes);
w.Close();
fs.Close();
edit1: looks like official docs saying that saving to hard drive is disabled by security reasons. but how the hell others did it?? lol
You can’t use System.IO when using a webplayer. You could upload to a server using WWW, but you can’t write to a user’s harddrive.