Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by gp01kkky · Mar 21, 2014 at 04:27 AM · guitexturegui-buttongui-window

GUI Button overlay separate from main camera

Hi, I am working on a 3D game on android. My gamescene has a main camera pointing at about 45 degree rotation in x axis.

Now I would like to put in some touch button to my game. However I realize that the touch button does not display correctly due to the main camera view angle. How can I separate the touch buttons and other guiText from the main camera so that they can be displayed correctly.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by supernat · Mar 21, 2014 at 05:30 AM

I assume you are not using Unity's built-in GUI. Because that would not be affected by a camera. It's always rendered in screen space. However, there are two ways to do what you want. You can make your GUI button a child of the camera, and it won't matter where the camera is rotated, the button will follow. A second option is to create a 2nd camera to render the menu/GUI into. Here's a post that should provide enough details: http://answers.unity3d.com/questions/336671/additively-overlay-one-camera-on-another.html

The idea is to create 2 cameras. 1 camera is your main, but you set the Cull mask to ignore your UI layer (you must create this layer). You create a 2nd Orthographic camera that only renders the UI layer. You have to set the depth of the second camera to a bigger number than the depth of the main camera (or is it smaller, I can never remember, I think it's in the post link). You also have to tell the 2nd camera to only clear the depth buffer (this and the cull mask are settings on the camera in the editor's inspector). Now your 2nd camera can sit anywhere in the world with UI buttons in front of it at the proper positions. And since your 2nd camera is Orthographic, you don't have to worry about perspective issues. You basically just leave that camera alone, implement all of your UI over in front of it, and Unity will render first the main camera scene (without the UI layer), and then render the 2nd camera scene (which is only the UI layer).

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gp01kkky · Mar 22, 2014 at 02:13 AM 0
Share

Thanks a lot, I changed to the built in GUI.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Error : Expressions in statements must only be executed for their side effects. 1 Answer

2 Position GUI Texture Rocker Switch 0 Answers

GUI Button not displaying an icon 3 Answers

Detect Touch on GUI.Button in Script? 1 Answer

How Do I Make GUI ON Off Button with 2 Button States 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges