Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Screenshot Capture

Discussion in 'Scripting' started by AviB, Feb 13, 2015.

  1. AviB

    AviB

    Joined:
    Jan 28, 2014
    Posts:
    22
    Hi,

    I have simple function that uses
    Camera.Render() and a RenderTexture to get a screenshot. This is works perfectly while unity is running
    on Editor mode. I want to run it offline, I want unity to start, take a snapshot and exit. I have tried to use
    -executeMethod or implementing [InitializeOnLoad] class and call the function.
    Non of that works. I'm getting the same results as if I were disable the call to Camera.Render().
    So it looks like the Camera.Render() is not working.
    How can I make it work?
    Tnx
     
  2. AviB

    AviB

    Joined:
    Jan 28, 2014
    Posts:
    22
    I noticed that Camera.PixelRect is 0,0,0,0. When I'm setting it with new rect with legal resolution, it remains 0,0,0,0.
    Unity Guys how can I make to work?