Search Unity

Unity UI Use EventTriggers on GameObjects through the view of a RenderTexture.

Discussion in 'UGUI & TextMesh Pro' started by Creiz, May 23, 2019.

  1. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    130
    I'm rendering a scene over in a render texture. In that scene I have some interactable gameobjects that works correctly when I'm viewing them from the Main Camera, but when I set up the camera to render it on to the Render Texture, obviously it won't work.

    I have two cameras. One Main, which where the UI is. One Sub, which is the camera that renders the scene to a Render Texture that I set up in my UI. When I view the scene on my MainCam, everything works perfectly. But when I view it while the SubCam is rendering to the texture, it shows the scene and all, but I can't interact with the gameobjects. I'm figuring this is because I'm not actually hovering my mouse over the objects themselves, since they're away and only rendering.



    So here we have my setup. I want to be able to click on the Toons via the RenderTexture that is on the Upper Camera. Something like having a virtual pointer or something that appears on the bottom camera while I hover on the RenderTexture and captures events.