Skip to content

Fix double sound on Jötunn-styled buttons (#497) - #501

Merged
MSchmoecker merged 1 commit into
Valheim-Modding:devfrom
bpavlina:fix-button-double-sound
Oct 31, 2026
Merged

MSchmoecker merged 1 commit into
Valheim-Modding:devfrom
bpavlina:fix-button-double-sound

Conversation

@bpavlina

Copy link
Copy Markdown
Contributor

Fixes #497.

Since Valheim 1.0, ButtonSfx.OnSelect plays m_selectSfxPrefab (before 1.0 it was empty). With the default navigation mode, mouse down selects the button and mouse up fires onClick. Those two events are more than ButtonSfx's 2-frame guard apart. So every click that selects the button (in practice almost every click) played sfx_gui_select followed by sfx_gui_button.

This removes the m_selectSfxPrefab assignment from ApplyButtonStyle, so a click plays only the click sound, as before 1.0. Vanilla only sets a select sound on start-screen, character-selection and feedback buttons. Inventory, crafting, settings and build-menu buttons have none, so gamepad navigation between Jötunn buttons now matches those too. A mod that wants a focus sound can still set ButtonSfx.m_selectSfxPrefab on its own buttons.

Buttons that already had a ButtonSfx, for example ones cloned from a vanilla prefab, keep whatever select sound they had.

Not tested in game; checked against the decompiled 1.0 ButtonSfx.

Since Valheim 1.0, ButtonSfx.OnSelect plays m_selectSfxPrefab. Mouse down
selects the button and mouse up fires onClick, so every click on a Jotunn
styled button played sfx_gui_select and then sfx_gui_button.
@MSchmoecker
MSchmoecker enabled auto-merge October 31, 2026 15:24
@MSchmoecker
MSchmoecker disabled auto-merge October 31, 2026 15:24
@MSchmoecker
MSchmoecker merged commit b3a2388 into Valheim-Modding:dev Oct 31, 2026
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.

[BUG] ApplyButtonStyle adds a select sound that makes every button click play two sounds since Valheim 1.0

2 participants