- Home /
Static menus
How can I have gui menus that stay in one position on the screen if the camera moves around. At this time I have the menus in a camera based gameobject so when the camera moves the menus stay in the viewers view. Adding the menus to a camera gameobject offsets the pivot point. This is a problem and I think I have over complicated the situation.
My thinking is that I have total and separate control over the cameras, the player object, and the world object. But there has to be z planes or layers that I can put processes against for different executions of the game or viewer states.
Are you using OnGUI calls, or GUIElement objects? The answer changes quite a bit depending.
....or are you using NGUI? As syclamoth said, it depends on what GUI package you're using. With NGUI, you would keep your GUI managed by NGUIs camera, while the 3D handled by the other.
I am using ONGUI. I have an array of cameras that spin around a central point. I put menus on and they spin out of sight. How do I put the menu structure in a place that stays in the players view statically regardless of what the game action does? $$anonymous$$y solution was to put the menus in the camera array game object so the menus move with the view rotation. But this shifts the origin point off center based upon the average center of the included objects. I have not found how to move the origin point locally. This is a whole other nightmare. But I would appreciate any help.
Answer by iguana72 · Apr 02, 2012 at 07:09 AM
Well, I'm not sure what you're really trying to do, but I have this piece of code that'll center an image on the screen. Then you can mess with variables and such to add other pieces of it that you want.
var crosshairTexture : Texture2D; var position : Rect;
function Start() { position = Rect( ( Screen.width - crosshairTexture.width ) / 2, ( Screen.height - crosshairTexture.height ) / 2, crosshairTexture.width, crosshairTexture.height ); } function OnGUI() { GUI.DrawTexture( position, crosshairTexture ); }
Your answer
Follow this Question
Related Questions
how to use a "flash" type effect when switching camera views 0 Answers
Need Help With Camera on CarGame 1 Answer
DrawProcedural execution order with multiple cameras 1 Answer
2D Sprites scaling to multiple screen sizes - Colliders, 2D Sprite image sizes, SpawnPoints 0 Answers
How to disable VR (Oculus) with fade to black screen to avoid motion sickness? 0 Answers