• 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 AlanParsons · Aug 30, 2012 at 09:17 PM · bugiphonescreencapture

What is the proper way to hide GUI elements during a screenshot?

I have an iOS app with very simple requirements. Hide some GUI elements (a few buttons and sliders), capture screenshot, and save to iOS "camera roll".

I can get this to work fine when I build with "Development Mode" checked in Build Settings.

The problem arises when "Development Mode" is UNchecked.

The screencapture images are partially black, anywhere from 10-80% of the bottom of the image is completely black. No errors reported.

What I've tried:

  1. Application.captureScreenshot() is asynchronous. As such, you must "poll" the file system to see if the file is "done" being created. I've tried delaying this polling using a simple Invoke() as I thought it might be interfering with the capture.

  2. The ReadPixels() method, but this yields a 100% black image every time in addition to an error in the xCode debug console "OpenGLES error 0x0502 in /xcode_porject/Classes/iPhone_GlesSupport.cpp"

  3. Use 32 Bit Display Buffer as suggested here

  4. Tried WaitForEndOfFrame as defined here and variations of what is here

  5. Initializing capture in LateUpdate.

  6. Attaching screencapture script to camera initializing Application.CaptureScreenshot from OnPostRender. Identical results.

  7. QualitySettings.vSyncCount = 1; in a variety of places, no effect

  8. Delaying the "reenabling" of the gui elements even after Application.CaptureScreenshot coroutine has successfully generated image file discovered in poll to System.IO.File.Exists(). No effect.

I am at a COMPLETE LOSS as to the solution. 3 weeks of development, the project was finished, go to build beta distribution, uncheck "Development Mode" and the project comes to a crashing halt.

Is this a Unity for iOS Bug?

Comment
Add comment · Show 2
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 AlanParsons · Aug 30, 2012 at 09:24 PM 0
Share

I have a Game$$anonymous$$anager instance I made to manage game state. There are multiple GUI elements on OnGUI across a handful of Components. $$anonymous$$y game manager instance is accessed by these components by a public bool property named guiEnabled. In these components, OnGUI simply checks game$$anonymous$$anager.guiEnabled to deter$$anonymous$$e whether the element(s) are displayed.

avatar image DanjelRicci · Mar 05, 2013 at 02:18 PM 0
Share

Did you manage to solve this issue? I'm struggling with this problem right now...

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ScroodgeM · Aug 30, 2012 at 09:24 PM

  1. try to enable VSync, this should not let capturing screenshot while frame rendering

  2. try to make screenshot in this method

  3. also you can create rendertexture, render camera once to this rendertexture, read pixels, copy it to texture2d and save it as file

  4. also try this example

Comment
Add comment · Show 9 · 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 AlanParsons · Aug 30, 2012 at 09:28 PM 0
Share

Scroodge, thanks I will poke around with that. I updated my question adding a #4 as I forgot that I already tried WaitForEndOfFrame in a Coroutine.

avatar image AlanParsons · Aug 30, 2012 at 09:41 PM 0
Share

Also, RenderTexture class is only available in Unity Pro and I only have Unity with iOS Basic.

avatar image ScroodgeM · Aug 30, 2012 at 09:46 PM 0
Share

i still hope (1) or (2) can help 8)

avatar image AlanParsons · Aug 30, 2012 at 09:48 PM 0
Share

I'm currently trying #2. #1 was a bit confusing to me as the docs leave a bit to be desired. Can that property be set anywhere?

avatar image ScroodgeM · Aug 30, 2012 at 10:18 PM 0
Share

yes it can be set from QualitySettings

http://docs.unity3d.com/Documentation/Components/class-QualitySettings.html

Show more comments
avatar image
0

Answer by Kryptos · Aug 31, 2012 at 08:35 AM

Use a camera that does not render the GUI layer. You can also change the culling mask temporarily.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

10 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

Related Questions

Unity IL2CPP 0 Answers

HUGE Texture problems on iPhone when using animated UVs 2 Answers

Input Text Rotated incorrectly... is this a BUG? 1 Answer

iOS Crash on call to EtceteraBinding.showAlertWithTitleMessageAndButtons from OnGUI 0 Answers

Graphics bug while testing on device? 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