Skip to content

How to create a custom cursor? #8613

Closed Answered by Ewan88
Ewan88 asked this question in Q&A
May 14, 2023 · 4 comments · 1 reply
Discussion options

You must be logged in to vote

I got it working.

Changed my code to look like this:

#[derive(Component)]
struct GameCursor {}

fn setup_cursor(
    mut windows: Query<&mut Window>,
    mut commands: Commands,
    asset_server: Res<AssetServer>,
) {
    let mut window: Mut<Window> = windows.single_mut();
    window.cursor.visible = false;
    let cursor_spawn: Vec3 = Vec3::ZERO;

    commands.spawn((
        ImageBundle {
            image: asset_server.load("cursors/point.png").into(),
            style: Style {
                //display: Display::None,
                position_type: PositionType::Absolute,
                position: UiRect::all(Val::Auto),
                ..default()
            },
            z_index: Z…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Ewan88
Comment options

You must be logged in to vote
1 reply
@JohnReedV
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants