Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 SoundDestroyer · Jul 30, 2015 at 06:37 PM · uisizecursorcursor-customization

How do I make my cursor smaller?

I'm creating a menu for a game and want to change the cursor to a hand when the mouse hovers over buttons. I'm using Cursor.SetCursor()

The problem is that, when I'm using CursorMode.Auto, the cursor its rendered way bigger than the default cursor. When I use CursorMode.ForceSoftware, its rendered nicely but its rendered to the left of where Im pointing.This is the code I use, which is attached to the camera object

 public Texture2D handCursor;
 
     public void hoverHand(){
         Cursor.SetCursor (handCursor, Vector2.zero, CursorMode.Auto);
     }
 
     public void returnCursor(){
         Cursor.SetCursor (null, Vector2.zero, CursorMode.Auto);
     }

I'm using Event trigger on the buttons. On pointer enter it calls hoverHand(), on pointer exit it calls returnCursor()alt text

This is the image I'm using. It's 17 X 22

alt text

Hope you guys can help me! Have a nice day.

captura-de-pantalla-146.png (11.7 kB)
captura-de-pantalla-145.png (12.5 kB)
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by nullgobz · Jul 31, 2015 at 12:06 AM

The Cursor.SetCursor will auto resize your cursor to 32x32 if its smaller when using CursorMode.Auto. And i would not recommend using software rendering.

What you could do if you really wanted a smaller cursor is make your own. Example: Texture2D Cursor; int Width = 16, Heigth = 16; Vector2 mouse;

 function Start()
 {
    Screen.showCursor = false;
 }
 function Update()
 {
    mouse = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
 }
 function OnGUI()
 {
    GUI.DrawTexture(new Rect(mouse.x - (Width / 2), mouse.y - (Heigth / 2), Width, Heigth), Cursor);
 }

Yeh im aware that OnGUI is the legacy system. You could do it with the uGUI if you prefer.

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 unity_x_qe4ZQcRm_jUg · Sep 06, 2020 at 05:01 PM

Yeah Blackthornprod's video in that topic should cover your question if you are still here in 2020... :) In his second technique he doesn't use a texture for the cursor, but he makes the cursor invisible and stick a sprite on top of it instead. That way, it is possible to create cursor animations, change the cursor sprite if right clicking, make particle effects and of course scale it to infinity. Here is the video: https://www.youtube.com/watch?v=cCKlMAwvQcI

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Cursor Resize? 1 Answer

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

How Can I Lock The Cursor Position? 1 Answer

How to prevent mouse lag/latency for custom cursor? 0 Answers

Cursor appears dark in game 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