resetting custom cursor to default
Asked Answered
P

2

0

I set a custom cursor for my attack mode and want to set it back to the default cursor once the attack is finished. Setting the cursor works fine, but when I reset the custom cursor to null, it doesn't change and remains the custom cursor instead. Am I doing something wrong? I checked in the debugger, Input.set_custom_mouse_cursor(null) is definitely called, but has no effect. I'm on a Linux system, if that makes any difference.


func arm_scissors(arm):
   if arm and energy > ENERGY_PER_CUT:
    $Scissors.visible = true
    scissors_armed = true
    Input.set_custom_mouse_cursor(target_cursor, 0, Vector2i(15,15))
  else:
    $Scissors.visible = false
    scissors_armed = false
    Input.set_custom_mouse_cursor(null)
Perpetuity answered 14/10, 2023 at 11:10 Comment(0)
M
0

Perpetuity but when I reset the custom cursor to null, it doesn't change and remains the custom cursor instead

So don't set it to null, instead define a variable for 'default' cursor and make sure your state changes always set it to default when appropriate?

Mahogany answered 14/10, 2023 at 17:6 Comment(0)
P
0

Mahogany
Yeah, I ended up creating a new default cursor anyway. I was just surprised it did not work like it was supposed to according to the documentation, and I wonder if this is a bug or if I'm just too stupid to understand it.

Perpetuity answered 14/10, 2023 at 18:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.