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
1
Question by FusionSausage · Oct 13, 2013 at 04:06 PM · guigameobjectobjectshow

Gameobject shown as GUI

Hi, what is the best way to show a GameObject as a GUI? I would like a GameObject up in a corner spinning around. What's the best way to do that?

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
4
Best Answer

Answer by Tomer-Barkan · Oct 13, 2013 at 04:21 PM

Best way I found is to create a second camera, called GUI Camera. Then set the camera clear flags to "Depth Only", and set the camera Culling Mask to GUI. Set the depth to 1. In the main camera, set the culling mask to everything except GUI. Set the main Camera's depth to 0 (this way the GUI camera will draw over the main camera).

Now you have a camera that will only display elements with the layer "GUI", and the main camera which will display all other elements. The GUI stuff will always appear above the other stuff.

Keep the GUI camera static, and place any objects you want to display as GUI in the view area of that camera, and make their layer "GUI". Their location will remain constant regardless of how you move the main camera.

Comment
Add comment · Show 19 · 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 Owen-Reynolds · Oct 13, 2013 at 04:35 PM 0
Share

To put it in the corner, adjust the camera rect numbers. Ex: width=0.1, x=0.9; same for y. It will look distorted when you set just one, but looks fine when width&height are proportional.

avatar image FusionSausage · Oct 13, 2013 at 04:46 PM 0
Share

Ok, thanks for the answer. Do you think this is the best idea or is it better to just have an image?

avatar image Tomer-Barkan · Oct 13, 2013 at 04:51 PM 0
Share

If your GUI is very simple and works well with 2D images, you can use GUITexture: http://docs.unity3d.com/Documentation/Components/class-GuiTexture.html

Their position is absolute on the screen (0 to 1, where 0 is left 1 is right), and they always draw on top of other objects.

But if you want to use more complex GUI shapes than just squares, and be able to use RayCast from the GUI camera to see if the player clicked on that complex shape, then go with what I suggested.

avatar image FusionSausage · Oct 13, 2013 at 04:56 PM 0
Share

Ok, but I can't seem to find "GUI" under the Culling $$anonymous$$ask... $$anonymous$$ight have something to do with that I don't have pro?

avatar image Tomer-Barkan · Oct 13, 2013 at 05:08 PM 0
Share

$$anonymous$$ake sure you have a GUI layer defined:

alt text

gui.png (18.1 kB)
Show more comments

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

18 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

Related Questions

GUI on click 2 Answers

How do I get a single object to move? 1 Answer

Gathering GameObjects and then creating a button for each GameObject?? 2 Answers

Need Ideas How To Get Started With A In Game Computer? 1 Answer

Can't destroy an arrray with GUI Text 1 Answer


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