I have a question about an effect I’m trying to accomplish. I think it should be straightfoward, but something is amiss.
I have a radar/hud camera. I use a Normalized View Port Rectangle to define where it displays. I also use the trick to make a round mask around what the camera sees. That works well. I’m trying to add a GUI background to the camera. This sort of works, but doesn’t work if the resolution or aspect ratio of the game window changes. So my question is, how do you maintain a GUI texture around the camera so that it scales properly.
If I use the GUI texture’s inset values to position and size it - it looks good at the game view resolution, but if I scale the window up, the HUD view gets bigger and the texture ends up inside the HUD… if I use the GUI texture’s transform/scale then the texture stretches…
Suggestions?
Cheers,
Paul
I had a simialr issue. If you have Unity Pro, you can do this:
-
Attach a Render To Texture texture to your camera (or a new one).
-
Create a GUITexture with the pixel offset and positioning you want to place it a a fixed size on the screen.
-
Choose the Render To Texture as the texture fore the GUI.
-
Now you can create and place a new GUITexture that will serve as your frame or background for the camera view.
The new documentation says this, but it’s a tricky detail: to get GUITexture objects to stack properly, they need to have their Z values set in their transform (X Y are screen percentage values for positioning on the screen).
A caveat: Intel graphics cards on Windows don’t do render to texture properly right now. Aras will be providing developers who need it an interim build of the Windows player sometime in the next two weeks to allow you to publish to Windows.
Thanks Doc, yep, I thought of something similar after I posted. The problem I encountered was that I didn’t use the rendered texture as a background, instead I used it on a rectangle that was parented to the main camera… I’ll give your suggestion a try, thanks again!
In regards to the player on windows… I can’t believe the amazing support the Unity team is giving with releases and aid on the forums. If only more developers were like this…
Cheers,
Paul