Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Cinemachine camera system and rendering into target textures

Discussion in 'Cinemachine' started by seiji_unity623, May 3, 2023.

  1. seiji_unity623

    seiji_unity623

    Joined:
    Oct 15, 2022
    Posts:
    6
    So I need to render what's on screen into a render texture. Before using cinemachine, this worked fine. But now, when I render the current camera into a render texture by setting the target texture of the current camera and using Camera.Render(), the wrong camera is rendered into the render texture.

    Any idea what might be going wrong here?
     
  2. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Heyyoo :) ,

    A VirtualCamera represents a position, rotation, lens settings... but what you see in the game view is done by the Camera component. Cinemachine places your Camera transform in the scene it does not do any rendering.

    Based on what you said assigning a render texture to a Camera prevents it from rendering in the game view. If you don't have any other camera with the tag MainCamera it randomly takes a camera in your scene (I think it's the next one in the hierarchy but not 100% sure). Maybe that's your issue?

    If you give us a little more informations about your setup we could give more insight of what's wrong. A screen shot of the hierarchy and inspector of your 2 camera would help. Maybe also any custom scripts calling Camera.Render() could be useful to understand what is going on.

    Hope this helps. If not let us know with the info we are missing ;) .
     
    Gregoryl likes this.