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 GameLvr · Jul 15, 2010 at 07:10 PM · charactercontrollerguitexturecursorcursor-customization

How do I keep a Custom Cursor (GUITexture) on top of UnityGUI controls?

How do I keep a Custom Cursor (GUITexture) on top of UnityGUI controls?

I've tried using layers with the cursor layer the highest Depth number on its camera, but my GUITexture is still underneath the control, box, lable, whatever

thanks

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

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by equalsequals · Jul 15, 2010 at 07:43 PM

UnityGUI is drawn last of all. Because of this there is no way to get anything outside of UnityGUI to draw on top of your UnityGUI.

My suggestion to you is to use OnGUI to draw your custom cursor using GUI.DrawTexture().

Hope that helps.

==

Comment
Add comment · Show 4 · 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 GameLvr · Jul 17, 2010 at 05:27 AM 0
Share

I tried DrawTexture and several other controls- they still draw under the existing GUI.Labels

How is the draw order controled?

avatar image equalsequals · Jul 17, 2010 at 01:53 PM 0
Share

GUI is immediate-mode and so it is drawn procedurally. The first draw command is on the bottom and the last is on the top. If your GUI draw calls are spread across multiple scripts you need to figure out which one executes last of all and at the end of that script is where you draw your custom cursor.

avatar image GameLvr · Jul 18, 2010 at 02:10 AM 0
Share

Thanks, I did try moving the cursor texture to the script where the label and boxes are, but although it works nicely over the labels, the boxes flicker badly when it is on top of them - seems odd

avatar image GameLvr · Jul 18, 2010 at 02:31 PM 0
Share

ok, I think I know what the problem is- The text should appear when the 3D object has mouse enter and disappear on mouse exit. I'm guessing when the box control comes on and they are both over the 3D object, it blocks mouse-overs by forcing a mouse exit- and turns itself off, so now I get another mouse enter to turn it on again- result, flicker.

I can make my Label look like a box, though, so it looks like I have a solution :)

avatar image
0

Answer by 5seaton4 · May 06, 2011 at 03:41 AM

go into your script and in the OnGUI method type GUI.depth = 0; "0" being it gets shown on top of all things. hope this helped.

Comment
Add comment · 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
0

Answer by password · Jul 06, 2011 at 02:39 AM

THANK for help.

Comment
Add comment · 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

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

1 Person is following this question.

avatar image

Related Questions

How Do I Lock the Cursor to the Center of the Screen? 1 Answer

cursor misbehaves in the UI 0 Answers

How to make custom cursors work without enabling "Run in Background"? 1 Answer

Cursor / MouseOver Glitch 0 Answers

Glue mouse to object 2 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