Skip to content

Conversation

@wjt
Copy link
Member

@wjt wjt commented Jan 21, 2026

Set default mouse cursor in code, not project.godot

When I first set the default cursor in commit
8e736db ("Add custom mouse pointer"), I
wrote:

Doing this in project.godot only overrides the default cursor shape;
other shapes (I-beam, hand, etc.) must be done in code. I believe we
don't use any other shapes in the game so let's use project.godot.

Since commit 4dc1272 ("Mouse manager:
Set custom cursor for cross shape") that last sentence is no longer
true. It is more consistent to specify all the custom cursors in one
place, in the code.

In addition, setting the cursor in code rather than in project.godot
works around a Godot bug where specifying the cursor in project.godot
causes an error when the project is first imported into the editor,
because the image is accessed before the project has been scanned so the
UID is unknown:

ERROR: Unrecognized UID: "uid://cee2juvnxco6c".
    at: get_id_path (core/io/resource_uid.cpp:199)
ERROR: Condition "local_path.is_empty()" is true. Returning: Ref<ResourceLoader::LoadToken>()
    at: _load_start (core/io/resource_loader.cpp:568)

The downside of doing it this way is that the OS default cursor will be
seen until the mouse_managers autoload is initialized. I don't think
this is a significant issue.

Resolves #1838

When I first set the default cursor in commit
8e736db ("Add custom mouse pointer"), I
wrote:

> Doing this in project.godot only overrides the default cursor shape;
> other shapes (I-beam, hand, etc.) must be done in code. I believe we
> don't use any other shapes in the game so let's use project.godot.

Since commit 4dc1272 ("Mouse manager:
Set custom cursor for cross shape") that last sentence is no longer
true. It is more consistent to specify all the custom cursors in one
place, in the code.

In addition, setting the cursor in code rather than in project.godot
works around a Godot bug where specifying the cursor in project.godot
causes an error when the project is first imported into the editor,
because the image is accessed before the project has been scanned so the
UID is unknown:

    ERROR: Unrecognized UID: "uid://cee2juvnxco6c".
        at: get_id_path (core/io/resource_uid.cpp:199)
    ERROR: Condition "local_path.is_empty()" is true. Returning: Ref<ResourceLoader::LoadToken>()
        at: _load_start (core/io/resource_loader.cpp:568)

The downside of doing it this way is that the OS default cursor will be
seen until the mouse_managers autoload is initialized. I don't think
this is a significant issue.

Resolves #1838
@wjt wjt requested a review from a team as a code owner January 21, 2026 13:48
@github-actions
Copy link

Play this branch at https://play.threadbare.game/branches/endlessm/wjt/set-default-mouse-cursor-in-code-not-project-godot.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@wjt wjt merged commit 5cce439 into main Jan 21, 2026
6 checks passed
@wjt wjt deleted the wjt/set-default-mouse-cursor-in-code-not-project-godot branch January 21, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Unrecognized UID" warning for custom mouse pointer during initial import

2 participants