Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 ZeKurt · Jul 18, 2011 at 12:02 AM · cursorcustom

UNITY3D: Custom cursors?

Hi, I'm developing my main menu for my game and I want a custom cursor for this. Is there anyway I could do that?

Comment
Add comment · Show 2
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 SilverTabby · Jul 18, 2011 at 12:23 AM 0
Share

This might be a bit ghetto, but I would just use GUI.DrawTexture() at Input.mousePosition and pass your cursor image into GUI.DrawTexture().

Simple but effective.

http://unity3d.com/support/documentation/ScriptReference/GUI.DrawTexture.html

http://unity3d.com/support/documentation/ScriptReference/Input-mousePosition.html

avatar image Eric5h5 · Jul 18, 2011 at 12:25 AM 0
Share

@SilverTabby: Use Event.current.mousePosition in OnGUI, not Input.mousePosition. Otherwise you get screen coords ins$$anonymous$$d of GUI coords.

3 Replies

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by YikYikHeiHei · Jul 18, 2011 at 04:28 AM

Here a script ---

And now is use Event.current.mousePosition---

 var yourCursor : Texture2D;  // Your cursor texture
 var cursorSizeX : int = 16;  // Your cursor size x
 var cursorSizeY : int = 16;  // Your cursor size y

 function Start()
 {
     Screen.showCursor = false;
 }

 function OnGUI()
 {
     GUI.DrawTexture (Rect(Event.current.mousePosition.x-cursorSizeX/2, Event.current.mousePosition.y-cursorSizeY/2, cursorSizeX, cursorSizeY), yourCursor);
 }
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 Eric5h5 · Jul 18, 2011 at 04:59 AM 2
Share

As I said, don't use Input.mousePosition in OnGUI, use Event.current.mousePosition. Then you don't have to convert coords.

avatar image ZeKurt · Jul 18, 2011 at 11:34 AM 0
Share

Thank you!

avatar image dkozar · Jul 11, 2012 at 04:33 PM 0
Share

Or you could use the framework: http://edrivenunity.com/cursors

avatar image betaFlux · Apr 03, 2015 at 12:08 PM 0
Share

That's exactly what I was looking for. Thanks!

avatar image
2

Answer by tsmitro · Jun 11, 2013 at 01:55 PM

Unity provides built-in support for custom cursors under the Player Settings. I don't know if this was supported in whatever version of Unity was around during the first post, but I figured I'd put this up for those of you still looking.

Comment
Add comment · Show 2 · 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 Serdnad · Jul 31, 2014 at 09:17 PM 0
Share

Thanks for adding this, future answers can be even more helpful.

avatar image $$anonymous$$ · Sep 18, 2014 at 10:42 PM 0
Share

But you would be able to do more with other methods, but unity's built in method is -probably- bug free. lol

avatar image
0

Answer by RKSandswept · Oct 03, 2013 at 08:17 AM

I also found that the image used for the cursor must be set to cursor, and also point scaling (not bi-linear nor tri-linear). If it is not set to point I always got a 50% opaque purplish square instead.

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

9 People are following this question.

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

Related Questions

A node in a childnode? 1 Answer

custom mouse changing when hovering over objects 1 Answer

Cursor disappears in unity. 1 Answer

customize watermark in unity pro 1 Answer

ngui don't supprot cursor editor text when using input running at wp8. has anyone found a way to fix it? 0 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