Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Black RawImage with RenderTexture from Camera.targetTexture source (Daydream mode only)

Discussion in 'Daydream' started by rroylance, Feb 28, 2019.

  1. rroylance

    rroylance

    Joined:
    May 1, 2018
    Posts:
    12
    I have an in-game camera and am using a Camera (not the main Camera) as the camera and using the Camera.targetTexture to render to a RenderTexture which I then use in a RawImage as the viewfinder for my in-game camera.

    This works great in Editor, Android normal mode, but in Android Daydream mode the RawImage is just black. Using the exact same camera to render to a PNG to save when the user takes a picture works great, so it's just the Camera.targetTexture/RawImage part that seems to be causing the issue in Daydream mode.

    Has anyone had experience with this? I've tried everything I can think of and none of the previous threads about black RenderTexture have shed any light on it and I have found no reference to this issue only coming up in Daydream mode.

    Unity Version 2018.2.2f1

    Thanks!
     
    Last edited: Feb 28, 2019
  2. rroylance

    rroylance

    Joined:
    May 1, 2018
    Posts:
    12
    As is most often the case;

    A seemingly weird pain in the butt problem that took way too much time to try and figure out, turned out to have a super simple solution... when in Daydream mode you need to manually tell any additional camera's to render (Camera.Render()). Hence why taking my screenshots still worked fine when the RawImage was just black, the camera was never being rendered :|

    I guess in Daydream mode only the main camera is rendered automatically each frame? Is there documentation anywhere that states this that I just overlooked?
     
    eiked likes this.