Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
3
Question by StevieKool · Nov 16, 2009 at 09:21 PM · graphicsscreenshot

Is is possible to output screenshots from Unity?

I'm creating a car configurator and after the user has customized their car, I'd like to output a jpg screencap and submit it to the server. Is this even possible?

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

5 Replies

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

Answer by Ehren · Nov 16, 2009 at 09:52 PM

Yes, it's possible to output screenshots.

The following doc page contains an example of uploading a png of the current frame to a server.

http://unity3d.com/support/documentation/ScriptReference/WWWForm.html

I haven't tried it, but hopefully the code still works in 2.6.

EDIT: From the Blurst Technology blog: JPEG Encoding in Native Unity JavaScript.

Comment
Add comment · 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
3

Answer by Bampf · Nov 16, 2009 at 09:56 PM

Yes, it is possible. I haven't done this myself, but in theory you could approach it the following way, if you have Unity Pro.

  1. Set up a RenderTexture, and tell a camera in your scene to render to it.

Documentation: http://unity3d.com/support/documentation/Components/class-RenderTexture.html

  1. Of course, sending raw pixels for a large image might be prohibitive. If this is a problem you might be able to use the Texture2D class's EncodeToPNG method for compressing the image to PNG format. There is some sample code in the Unity documentation that even shows how to save it to a file.

[sorry - I'm a new user, can only post one hyperlink. Just search the Unity script reference documentation for Texture2D.EncodeToPNG.]

A small complication: RenderTexture and Texture2D are both subclasses of Texture, but offhand I do not see support for directly copying from one to the other. So you may need to do a GetPixels from the RenderTexture, then SetPixels to a new Texture2D object. Then you can use Texture2D's EncodeToPNG method as planned.

Hope this helps.

Comment
Add comment · Show 1 · 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 Bampf · Nov 16, 2009 at 10:03 PM 0
Share

I see Ehren posted an answer just as I did, and his answer seems closer to what you were asking for. $$anonymous$$y answer might have value in two situations however, so I think I will leave my answer up for posterity. 1) If the image being rendered isn't the full screenshot but ins$$anonymous$$d some other view, you would want to render from a camera. 2) If you wanted to save to a file locally rather than send it to a server. For example if you wanted to generate a thumbnail image for a saved game.

avatar image
1

Answer by duck · Nov 16, 2009 at 10:06 PM

It sounds like your project is probably a webplayer build, but in case it's not, you should probably also check out: Application.CaptureScreenshot

Of course you'll still need the WWWForm class to upload the file it creates.

Comment
Add comment · 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
1

Answer by Ricardo · Nov 30, 2009 at 05:37 PM

A couple days ago there was a post on the Blurst technology blog about encoding JPEGs from UnityScript, which they use on Splume to upload to their server level editor thumbnails. Their post is informative and might be able to help you.

Comment
Add comment · 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
1

Answer by William Grand · Apr 23, 2010 at 08:26 PM

Any idea how to send a screenshot to the printer?

Comment
Add comment · Show 1 · 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 jashan · Jul 21, 2010 at 11:29 AM 2
Share

Adding a question as an answer to a question probably won't give you an answer. Anyways: I don't think this is even possible without using plugins. You might get it working in standalones, though ...

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

No one has followed this question yet.

Related Questions

ReadPixels() vs Windows ScreenShot 0 Answers

Screen explodes into colors bug, "screen position outside of view frustum" 0 Answers

How to Render to Fullscreen Texture pixel perfect 2 Answers

OpenGLES2 Problems 0 Answers

Small line appearing under my 2D pixel sprite - 2D Graphics not rendering properly 2 Answers


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