Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Jake-L · Jan 01, 2013 at 01:09 PM · editorreadpixelsgameview

ReadPixels to capture GameView in EditMode and "Pixels out of bounds"

Hi,

I'd like to create snapshot a series of frames from the editor Gameview window using ReadPixels. This works to some degree, but I get the "Pixels out of bounds" error randomly.

My guess is that this error occurs if I try to capture the screen while the frame isn't completely rendered. At runtime I would use yield WaitForEndofFrame() to take care of this, but yielding isn't possible in Editmode.

I tried to place my code inside EditorWindow.Update() and to hook into EditorApplication.update - doesn't matter, the error occurs randomly. Using OnGUI() works if I just take one screenshot triggered by a GUI button, but I need to render and snapshot several frames, and the GameView won't update using GameView.Repaint() inside the ONGUI call. I tried to spread this to several OnGUI calls (by forcing GUI repaiting), but then I got "Pixels out of bounds" again.

I really appreciate any help on this topic

Jake

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Zebibto · Aug 15, 2013 at 02:01 PM

I was trying to take screenshots of the SceneView to no avail. So this little script takes screenshots of the active GameView.

Add the component to the camera you want to take shots with and take a single or multiple screenshots. This works while in editor without the game running and also while the game is running, although the timing is probably messed up.

NOTE: The Gameview must be visible or the WaitForEndOfFrame never occurs and the screenshot never gets taken. You can also take the screenshot in OnPostRender like spectre suggested.

[1]: /storage/temp/14330-screenshottool.zip


screenshottool.zip (3.6 kB)
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
0

Answer by entwisled · Aug 10, 2013 at 02:35 PM

I have exactly this issue, but I only want to get on screenshot. Did you ever work-out a work-around?

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 Jake-L · Aug 11, 2013 at 10:55 AM 0
Share

Unfortunately not, I gave up on that subject.

avatar image
0

Answer by spectre1989 · Aug 11, 2013 at 12:23 PM

Try putting the script on the camera, and calling ReadPixels in OnPostRender.

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

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

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Stepping through WaitForEndOfFrame when GameView isn't visible 1 Answer

Disable 'Scene is missing fullscreen camera' message 0 Answers

How to manually update GameView? 3 Answers

Texture.ReadPixels and iOS Problems 2 Answers

How to capture pixels with .ReadPixels through an editor script? 0 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