• 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
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

People who like this

0 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

  • Sort: 
avatar image

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

People who like this

0 Show 0 · 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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

25 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

Related Questions

Taking screenshot from a second camera 0 Answers

Texture2D saves as PNG correctly but doesn't display properly in RawImage 1 Answer

Use the canvas scaler to resize UI on a RenderTexture's resolution ? 0 Answers

Screenshot from a rendertexture (non-main camera) to fit sprite (in 3D space) exactly 1 Answer

Problem with screenshot on render texture 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