Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DEtH_MoroZ · Aug 19, 2011 at 10:46 PM · texturewebplayerimagesavepng

How to save runtime generated texture in Webplayer to hard drive?

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

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Eric5h5 · Aug 19, 2011 at 10:50 PM

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.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DEtH_MoroZ · Aug 19, 2011 at 10:52 PM 0
Share

tyvm for fast respond. did i understand it right: it is not possible to save !!!ANY!!! data on pc by webplayer. right?

avatar image Eric5h5 · Aug 19, 2011 at 11:12 PM 0
Share

Correct .

avatar image DEtH_MoroZ · Aug 19, 2011 at 11:48 PM 0
Share

hmmm. may be its kinda another question, but its actual for me: can i have some resourses, that player / user will download separatly, and then webplayer will use them? (yes, i understand that this is off topic. all i need is yes or no :) ) (that actually can solve this problem i think)

tyvm :)

avatar image Eric5h5 · Aug 20, 2011 at 12:51 AM 0
Share

The webplayer has no access to the user's harddrive for security reasons, aside from caching assetbundles.

avatar image DEtH_MoroZ · Aug 20, 2011 at 12:52 AM 0
Share

ok, tyvm alot.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How can I resize an image and save it to disk ? 6 Answers

Is there a way to save a texture to the iPhone/iPad? 2 Answers

Make an Array of Arrays of Textures 1 Answer

[solved] How to save instance of the texture? 2 Answers

Apply texture on prefab 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges