Search Unity

Render GUI to texture

Discussion in 'Immediate Mode GUI (IMGUI)' started by ratamorph, Feb 19, 2008.

  1. ratamorph

    ratamorph

    Joined:
    Sep 2, 2007
    Posts:
    458
    I think this has been asked before, I couldn't find a straight answer on wether or not I can render GUI onto a texture so I can use it on 3D objects, like a computer in my 3D world displaying some GUI, maybe even interact with it like in Doom 3.

    I was trying to use a camera to render just the GUI and output the render onto a texture, the problem is that no matter what I do the the main camera always sees the GUI, is it possible to do what I'm trying to do?
     
  2. Marc

    Marc

    Joined:
    Oct 4, 2007
    Posts:
    499
    If you remove the gui layer from the main camera it will not display the gui. So you maybe you can add a second camera with a gui layer and render to the texture from that. About interactivity of the gui like in doom3 you prob gonna have to do some coding and dection of things your self but im not sure about that.
     
  3. ratamorph

    ratamorph

    Joined:
    Sep 2, 2007
    Posts:
    458
    Is there a built in layer for the GUI? I don't seem to be able to find one, I tried creating a custom layer for it and assigning it to the object that holds the script that draws the GUI, then I removed that layer from the main camera mask but camera still displays the GUI.

    I'm using Unity 2.0 GUI by the way, I also tried removing the GUILayer component in the main camera and nothing happened, which is what I expected since the docs say the GUILayer component doesn't affect UnityGUI...
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Right, the GUI layer is for GUITexture and GUIText objects. There isn't a layer for the 2.0 GUI as far as I know.

    --Eric