Skip to main content
Up and Coming
November 7, 2014

OnGUI Fix Please

We have made an Oculus version of our Motorbike game, and it plays awesome : )

The user interface is made with OnGUI controls which cannot be rendered separately within Unity.

I assume the solution has to be worked out with Unity. It is necessary that the OnGUI controls get rendered into a RenderTexture not the screen directly.

If anyone has a solution, please share it. There seems to be many other developers with the same problem.

Regards
Andres
    This topic has been closed for replies.

    14 replies

    Up and Coming
    November 7, 2014
    Before 4.6, I was using render textures. Now I'm using the world space canvases in 4.6 and later (I'm using 5). It works great.
    Inspiring
    November 8, 2014
    The new 4.6 UI is probably your best bet. But if you absolutely need to use OnGUI, have a look at how we do OVRMainMenu. It renders to a texture and puts that on a quad in front of the user. Unfortunately, it causes rendering artifacts if you use deferred lighting because we set RenderTexture.active in the OnGUI callback.
    Up and Coming
    November 8, 2014
    "vrdaveb" wrote:
    The new 4.6 UI is probably your best bet. But if you absolutely need to use OnGUI, have a look at how we do OVRMainMenu. It renders to a texture and puts that on a quad in front of the user. Unfortunately, it causes rendering artifacts if you use deferred lighting because we set RenderTexture.active in the OnGUI callback.


    4.6 is not support with Unity free as far I as I understand, would OVRMainMenu that renders to a texture work in the Unity Free version?
    Up and Coming
    November 8, 2014
    Would creating 3d text / objects with mouseover scripts on each be an option as a menu in Unity Free? Would that work?
    Up and Coming
    November 8, 2014
    "khos85" wrote:
    "vrdaveb" wrote:
    The new 4.6 UI is probably your best bet. But if you absolutely need to use OnGUI, have a look at how we do OVRMainMenu. It renders to a texture and puts that on a quad in front of the user. Unfortunately, it causes rendering artifacts if you use deferred lighting because we set RenderTexture.active in the OnGUI callback.


    4.6 is not support with Unity free as far I as I understand, would OVRMainMenu that renders to a texture work in the Unity Free version?


    Do you mean that you don't have access to 4.6 as a free user or that the Rift doesn't work with the free version of 4.6 yet? I know that 5 beta is only available for subscribers or preorders, I wasn't sure about 4.6. Anyway, they just released release candidate 1 for 4.6 so rift support should be in it and it shouldn't be too long of a wait before 4.6 final is released.
    Up and Coming
    November 8, 2014
    "GoesTo11" wrote:
    "khos85" wrote:
    "vrdaveb" wrote:
    The new 4.6 UI is probably your best bet. But if you absolutely need to use OnGUI, have a look at how we do OVRMainMenu. It renders to a texture and puts that on a quad in front of the user. Unfortunately, it causes rendering artifacts if you use deferred lighting because we set RenderTexture.active in the OnGUI callback.


    4.6 is not support with Unity free as far I as I understand, would OVRMainMenu that renders to a texture work in the Unity Free version?


    Do you mean that you don't have access to 4.6 as a free user or that the Rift doesn't work with the free version of 4.6 yet? I know that 5 beta is only available for subscribers or preorders, I wasn't sure about 4.6. Anyway, they just released release candidate 1 for 4.6 so rift support should be in it and it shouldn't be too long of a wait before 4.6 final is released.


    Hi, I'd love to go to 4.6 (to use new UI stuff) but can you show me where it states that Oculus Rift is supported in the 4.6 Free version? I do not think it is supported yet...please prove me wrong.
    Up and Coming
    November 8, 2014
    "khos85" wrote:
    ...please prove me wrong.


    I'm not going to prove it to you since I really don't care that much. I don't see why 4.5 would have support and 4.6 wouldn't. I would think that 4.6 release candidate would be feature complete. It wouldn't take much for you to try it out to see.
    baknoAuthor
    Up and Coming
    November 11, 2014
    After some research, we found it is possible to make OnGUI to render into a RenderTexture.

    Just call RenderTexture.active = YourRenderTexture before the OnGUICommands.

    Because of the usage of RenderTexture, this only works on Unity Pro.
    Up and Coming
    November 13, 2014
    "GoesTo11" wrote:
    "khos85" wrote:
    ...please prove me wrong.


    I'm not going to prove it to you since I really don't care that much. I don't see why 4.5 would have support and 4.6 wouldn't. I would think that 4.6 release candidate would be feature complete. It wouldn't take much for you to try it out to see.



    Anyway..I had 4.6 installed and imported the 043 sdk imported, nothing worked, then got told by the moderators here that only 4.5.5 works at the moment, I rolled back to that version and works well.. except the gui stuff :(.
    Inspiring
    November 13, 2014
    "khos85" wrote:
    Anyway..I had 4.6 installed and imported the 043 sdk imported, nothing worked, then got told by the moderators here that only 4.5.5 works at the moment, I rolled back to that version and works well.. except the gui stuff :(.

    This is because that particular build of 4.6 beta you tried hadn't caught up with the most recent changes in 4.5.5 yet. I thought I heard that 4.6 is caught up now (to include free Rift development), but I'm not exactly sure which builds are equivalent.
    Titans of Space PLUS for Quest is now available on DrashVR.com