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 WavyRancheros · Aug 25, 2015 at 06:31 AM · rendertexturelayersscreenshot

Screenshot only with specified cameras

Hi everyone,

I want to take a screenshot of my game. BUT I want to limit the screenshot to specific cameras. AND while the screenshot is taken, the user should not see any changes to the game. There should be a camera shutter effect on the UI, but that should not be part of the screenshot.

In this example, I have 4 cameras:

  • Camera 1 renders the cube on Layer A. Clear Flag: Skybox

  • Camera 2 renders the 2 cylinders on Layer B. Clear Flag: Depth Only

  • Camera 3 renders the 1st User Interface (Canvas 1) on Layer C. Clear Flag: Depth Only

  • Camera 4 renders the 2nd User Interface (Canvas 2) on Layer D. Clear Flag: Depth Only

I only want the screenshot to include Camera 1, 2 and 3.

Here's what the player should see during gaming: What the player should see

Here's what the screenshot should look like after it was taken and saved: What the saved screenshot should be

02-what-the-screenshot-should-be.jpg (72.2 kB)
01-what-the-player-sees.jpg (84.7 kB)
Comment
Add comment · Show 1
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 WavyRancheros · Aug 25, 2015 at 06:33 AM 0
Share

Here's the layering of the cameras: The layering of the cameras

07-layering.jpg (89.1 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by matthewseaward · Aug 25, 2015 at 02:55 PM

Have you tried just disabling the cameras you don't need? Put it into a coroutine and it should be fine. I needed something similar - I only wanted to take a screenshot from one camera in a fixed point but not the GUI and main camera.

 IEnumerator Screenshot()
 {
     // Disable unrequired cameras
     mainCamera.enabled = false;
     GUICamera.enabled=false;
 
     // Enable the camera to take a screenshot with 
     photographer.enabled=true;
 
     yield return new WaitForFixedUpdate();
 
     GetComponent<AudioSource>().PlayOneShot (shutter);
     
     int width = Screen.width;
     int height = Screen.height;
     
     Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24,false);
     yield return new WaitForFixedUpdate();
 
     tex.ReadPixels(new Rect(0,0,width, height), 0,0);
     tex.Apply();
 
     // Do whatever with screenshot
     Destroy (tex);
 
     mainCamera.enabled = true;
     GUICamera.enabled=true;
     photographer.enabled=false;
 
     yield return (0);
 }
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

26 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Best way to capture super large screenshot images (all GPUs) 0 Answers

Capture rendered scene to PNG with background transparent 6 Answers

Wierd Screen Shot Problem, texture of screen shot looks different in editor and in system. 1 Answer

Why can't I set RenderTexture.active? 0 Answers

Is it possible to take a screenshot and save a .png through a secondary camera on a layer the player cant see? 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