Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

change Camera.targetDisplay ?

Discussion in '2019.2 Beta' started by Innovine, Jul 22, 2019.

  1. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    I recently upgraded my project to use 2019.2 and notice the following odd behavior.. I am creating a camera which writes to a render texture, and in my initialization code I have:
    Code (CSharp):
    1. camera.targetDisplay = 1;
    However, when I press Play, and go to the camera in the Heirarchy, I can see that it is still set to Display 2. If I manually change this now to 1, it starts rendering to the texture as planned. I don't see why it does not work via the script though.

    Any suggestions?
     
  2. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Can anyone try this and see? Just set the camera.targetDisplay to an int. Using a script to get the value returns the newly set value, however the camera behaves as if a different value is set, one which is shown in the inspector. I have been unable to actually change the value from a script...
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    If you post a sample project that I just need to open and press play, I can give it a try.
     
  4. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Well never mind, I'm just stoopid :)
    Setting targetDisplay to 1 does not select "Display 1", it's the index, resulting in "Display 2".