Using mouse cursors as conditions

Godot Version

4.4.1

Question

Heyo, I’m trying to get a placement system down for a Tower Defense game, is there anyway I can set the cursor type as an image? My first thought was setting the cursor as a variable like below

var cursor = Input.set_custom_mouse_cursor("res://Assets/Sprites/cursor.svg")

However, this gives me an error

If what I’m asking is confusing, here’s some pseudo code

if mouse_cursor == cursor_a:
        Input.set_custom_mouse_cursor(cursor_b)

You need to use an image, not a path, so:

var cursor = Input.set_custom_mouse_cursor(preload("res://Assets/Sprites/cursor.svg"))

Error

Screenshot 2026-11-23 141235

Why do you need the change to return anything at all? What it is you’re trying to achieve?

The code isn’t valid in the first place even apart from the void return, but the solution to tracking what cursor is used is to keep a variable you set at the same time you set the cursor

Assuming that’s what you are trying to do, it doesn’t make sense to check the return value of the method setting the cursor though

Its not working because

Input.set_custom_mouse_cursor

Is a method or function (english is not my first language and im using c#) so by calling it you already change the cursor image. I dont know what you are trying to put in the variable, but calling a function doesnt give you anyithing to put in your variable. I hope that makes the error more clear.

This is not true, at least not in the way you presented it. Just because something is a function doesn’t mean it cannot return anything.

Calling a function DOES indeed return something you can use. That’s how so many functions work. That’s how things like get_angle_to work, that’s a function as well, and it returns a float variable. To say that a function will not give anything is simply wrong and misleading.

What IS true, is that certain functions have a void return type, which means they do not return anything, so you can’t really use their return value because it doesn’t exist. But that’s not because “they are a function or method”.

Im sorry for my misleading wording.

Of course there a functions, that have a return type.

My answer focused on the error the author had.

I will try to give better answers next time, but thanks for the feedback.