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 /
  • Help Room /
avatar image
1
Question by $$anonymous$$ · Apr 22, 2017 at 05:05 PM · scripting problemtexture2dcursorcursor-customization

Cursor.SetCursor() not working

I'm using Unity 5.6 and the Cursur.SetCursor() function doesn't seem to work. This is the script (Attached to an empty game object which is child of the camera):

 private void OnMouseEnter()
 {
         Cursor.SetCursor(cursorTexture, new Vector2(0, 0), CursorMode.Auto);
 }
 
 private void OnMouseExit()
 {
         Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
 }
 

Where cursorTexture is a Texture2D variable. It doesn't generate any error or warning but it just doesn't work at all.

I've also tried to change the cursor from Edit > Project Settings > Player but I get this warning "Invalid texture used for cursor"

This is the settings I'm using for the texture

alt text

I would like this to work through script because I don't want to always to have this kind of cursor. Thanks In advance.

texturesettings.png (29.7 kB)
Comment
Add comment · Show 4
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 PizzaPie · May 03, 2017 at 12:39 PM 0
Share

Tongle read/write enabled on the texture and apply the changes. It should work afterwards.

avatar image $$anonymous$$ PizzaPie · May 03, 2017 at 05:19 PM 0
Share

I've already tried, it doesn't work. I keep getting a warning

avatar image NlaakStudios · Jun 27, 2017 at 04:57 PM 0
Share

I am having the exact same issue. Using same Settings. Tried setting through Player Settings as well as Script. It works in editor but when I build executable I get just a black box.

What are we doing wrong - this seems like a basic brainless feature?

Is it Broke?

avatar image Insurikai_ · Jul 26, 2017 at 03:25 PM 0
Share

Does the GameObject you have this script on have a Collider of some type? If it doesn't then the Functions won't be called.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by NinjaPikachuu · May 03, 2017 at 07:47 AM

Im super noob to Unity, but maybe drag that into your scene, then make a prefab of it from your hierarchy. Then make that prefab your cursor texture.

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 $$anonymous$$ · May 03, 2017 at 05:22 PM 0
Share

I'm not sure what you mean by that. If you're talking about the texture image then you're totally wrong. Anyways thanks for answering.

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

134 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 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 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 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 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 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 avatar image avatar image

Related Questions

Problems with UI buttons and Cursor position (or) UI buttons and instantiated canvas. 1 Answer

Better way to edit RawImage texture data?,Better way to edit a RawImage texture? 0 Answers

LoadRawTextureData - how to use? 0 Answers

[SOLVED] Problems creating a Sprite through script 0 Answers

Can't see my custom cursor. 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