Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

custom cursor not showing up

I’m pretty new to c# and unity, and I was trying to make a custom cursor by attaching this code to the cursor gameobject. In the inspector, I can see that the gameobject is clearly following the mouse, but the gameobject just disappears when I start the game.

    void Start()
    {
        Cursor.visible = false;
    }

    void Update()
    {
        Vector3 cursorPosition = Input.mousePosition;
        transform.position = cursorPosition;
    
    } 

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You should use this function to set a new cursor Texture Cursor.SetCursor(Texture2D,CursorMode)" if you want to do it at runtime.
Also you can set the default cursor on menu Edit > Project Settings > Player > Default cursor

Documentation of this Method

Also you have to configure the Texture import to be a type cursor Texture, you can find the documentation of how set up a Texture cursor on this link:

Texture type Documentation

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading