X Tutup
Skip to content

Custom mouse cursor flickers in web build #102403

@Chubercik

Description

@Chubercik

Tested versions

  • Reproducible in: v4.3.stable.steam [77dcf97]

System information

Godot v4.3.stable (77dcf97) - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1080 Ti (NVIDIA; 32.0.15.7216) - Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 Threads)

Issue description

I wanted to have a custom mouse cursor in my game, and after googling for a solution, I came across this docs page: Customizing the mouse cursor.

I eventually ended up with this script:

extends Node

const TIP_LOC = Vector2(11, 6)

var cursor = load("res://sprites/cursor.png")
var cursor_click = load("res://sprites/cursor_click.png")


func _ready():
	Input.set_custom_mouse_cursor(cursor, Input.CURSOR_ARROW, TIP_LOC)


func _process(_delta: float) -> void:
	if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
		Input.set_custom_mouse_cursor(cursor_click, Input.CURSOR_ARROW, TIP_LOC)
	else:
		Input.set_custom_mouse_cursor(cursor, Input.CURSOR_ARROW, TIP_LOC)

I include it in any scene I want my custom cursor to be in (which is all of the playable scenes really).

This works well enough in the editor and on desktop (Windows) builds, I haven't noticed anything out of the ordinary.

However, after exporting the game to a web build (single-threaded, not sure if that matters here) and uploading that to itch.io, I noticed a rather jarring effect:

custom_cursor_gif

The custom mouse cursor flickers back and forth, changing to the system's default one.

Steps to reproduce

  1. Copy the code sample from above
  2. Attach it to a node
  3. Put the node in a playable scene
  4. Export to web

Minimal reproduction project (MRP)

Don't really have an MRP, but the game I noticed the issue on is up and running here: https://chubercik.itch.io/bubble-tea-spree.

The game itself is also open-source: https://github.com/Chubercik/bubble.

It was made for a game jam, so expect hacky code and sub-par composition practices.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup