Integer used when an enum value is expected error on set_custom_mouse_cursor

Godot Version

4.2.2

Question

In Global.gd script, which is a singleton, I have this function, that changes the cursor texture:

func changeCursor(cursor_texture) -> void:
	if cursor_texture != CURRENT_CURSOR:
		Input.set_custom_mouse_cursor(cursor_texture, 0, Vector2(7.0,4.0))
		CURRENT_CURSOR = cursor_texture

The problem is that in the Debugger panel on the bottom there is a warning error, that is really irritating:

W 0:00:01:0664   Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
  <GDScript Error>INT_AS_ENUM_WITHOUT_CAST
  <GDScript Source>Global.gd:15

Is there a way to get rid of this error?

Call it with: Input.CURSOR_ARROW instead

1 Like

You mean using CURSOR_ARROW as a second argument in set_custom_mouse_cursor method? Seems right to me, I’ll check it out tomorrow

1 Like