Cycle through cursors in game with mouse button clicks?

Hi all!

I’m trying to cycle through 3-4 different cursors when I press the right mouse button over and over again.
One click, one change. Next click → change to the next cursor…and so on.
Anybody knows how to do this via blueprint?



This is a simple way to do it.

1 - Import your cursors
2 - Create a player controller
3 - Create the cursor widget

4 - In the player controller, create the widget and set it as cursor widget. (Don’t forget to show the mouse cursor in your game)

5 - In the widget, create a widget switcher
6 - Add some images below it
7 - Create a custom event in the graph to switch the cursor
8 - In the event, increment the widget switcher index (reset it if it reaches the max index)

9 - Back in the player controller, call the event when you click on the mouse button.

10 - Enjoy! :slight_smile:

Hi Alex,

Thanks, I’ll try this out!
Is it possible to use only one image that has 4 different cursors on it and tell the engine which area to display from the image? (1st click upper left, 2nd click upper right, 3rd click lower left, 4th click lower right)
Like a flipbook or something…

There is multiple ways you can do this.

Using a flipbook is more complex in my opinion, but you can import one sprite sheet with all your cursors, and then right click on it, choose ‘Sprite Actions’ and ‘Extract Sprites’.
You will have all the separated sprites based on your sprite sheet, then you can create a flipbook with them, or simply use them to set the image inside the widget.
You don’t need to use a widget switcher if you don’t want to. You can directly switch the image source of the Image object. (With textures, sprites, materials, etc.)

Also, you can use a dynamic material if you want.
Add your sprite sheet inside it and then manipulate the uv coordinates with a scalar parameter.

Sounds good, thanks for the info! :slight_smile:

Ok, I think I’m missing something, since it does not work.
Where can I get and set the Cursor Widget? (image nr1)
Also my Cursor_Widget graph looks like this. (image nr2)

The Player controller is ok as if I uncheck the show mouse cursor, then it gets hidden. But doesn’t show the custom images.

Now it works.

Ok, now I’d like to be able to check, whitch cursor image is the active one …like is the Eye cursor active? If true, then do this, else do something else…

You have the index of the widget switcher (if you are using this method)
If the ‘‘Eye Cursor’’ is at the index 3, simply check if the current index is 3.
Or you can use a switch