Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Change the Cursor depending on what you're doing.

Hey,

if anyone knows how to change the cursor depending on what you're doing, for example when you're attacking that the Cursor isn't the default one, but a sword, or something like this, please let me know.

Thank you, meow!

Best Answers

  • MuscleDuckMuscleDuck Member
    Accepted Answer

    you can make a gameobject that follows the mouse and then switch the sprite though script or animation

  • MrBaileyQMrBaileyQ Member
    Accepted Answer

    Hi Lupusfilm,

    I Can Help!


    First Make An Int Call It Something Like "MouseIndex";

    Next Make A Vector2 Call It MousePos!

    Finaly Make Many Different "Texture2D" Depending On How Many Different Cursors You Want!


    Now In The Update Function, Write This:

    MousePos = Input.mousePosition;

    if(MouseIndex == Whatever Index You Want) {

            Cursor.SetCursor(What Your Texture2D Name Is, MousePos, CursorMode.Auto);

    }


    Then Just Copy And Paste This Until You Have All Of Your Cursors Done!


    Then If You Want To Change The Cursor Put This Line Of Code In:


    GetComponent<Script Name Goes Here>().MouseIndex = WhateverYouWant;


    Put This Script Onto A Game Object!


    Reference Everything And It Should Work!


    Hope This Helped. Stay Safe :)

Answers

Sign In or Register to comment.