Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity Cursor Not CPU Accessible

Discussion in 'Editor & General Support' started by owlangford1, Aug 28, 2022.

Thread Status:
Not open for further replies.
  1. owlangford1

    owlangford1

    Joined:
    Jun 11, 2022
    Posts:
    5
    I am trying to change the cursor on a unity game but no matter what I do I consistently get this error:

    Failed to set the cursor because the specified texture ('Cursor') was not CPU accessible.
    UnityEngine.Cursor:SetCursor (UnityEngine.Texture2D,UnityEngine.Vector2,UnityEngine.CursorMode)
    Player:Awake () (at Assets/Scripts/Player.cs:19)

    Here is my code:

    Code (CSharp):
    1. public Texture2D cursorTexture;
    2.  
    3. void Awake()
    4. {
    5.     Cursor.SetCursor(cursorTexture, Vector2.zero, CursorMode.Auto);
    6. }
    The cursor texture is a 64*64 PNG image.
    Any help would be appreciated.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,797
    You really should consider dropping your error messages into Google. :)

    How to report your problem productively in the Unity3D forums:

    http://plbm.com/?p=220

    This is the bare minimum of information to report:

    - what you want
    - what you tried
    - what you expected to happen
    - what actually happened, especially any errors you see
    - links to documentation you used to cross-check your work (CRITICAL!!!)
     
  3. grizzly

    grizzly

    Joined:
    Dec 5, 2012
    Posts:
    356
    Are the import settings correct? They should be;

    Texture Type: Cursor
    Alpha Is Transparent: True
    Read/Write : True
    Generate Mip Maps: False
     
  4. owlangford1

    owlangford1

    Joined:
    Jun 11, 2022
    Posts:
    5
    That fixed the problem. thank you!
     
    Meow_jeezz likes this.
  5. MattanC

    MattanC

    Joined:
    Jan 22, 2022
    Posts:
    2

    Amazing, short and helpful! Thanks!
     
    Meow_jeezz likes this.
  6. halivudestevez

    halivudestevez

    Joined:
    May 12, 2019
    Posts:
    13
     
  7. enesbagci2332

    enesbagci2332

    Joined:
    Apr 4, 2021
    Posts:
    82

    Thank you!
     
    russellnadin likes this.
  8. codemaker2015

    codemaker2015

    Joined:
    Aug 19, 2018
    Posts:
    27
    Ensure that you have change the texture properties as following in Inspector window,
    • Texture Type: Cursor
    • Alpha Is Transparent: True
    • Read/Write: True
    • Generate Mip Maps: False
     
    spaghettiSyntax likes this.
  9. PHUNMUNHONG

    PHUNMUNHONG

    Joined:
    Jun 1, 2021
    Posts:
    1

    I understand your frustration but the first result of searching this topic is this post
     
  10. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,797
    And??? What are the next ten responses?!!!

    You actually do notice that there are other responses that Google returns, almost all of them with different workarounds and things to check, right?

    If that is not a thing you know then perhaps you need to Google to learn how to use Google.
     
Thread Status:
Not open for further replies.