Repository navigation
Fix double sound on Jötunn-styled buttons (#497) - #501
Merged
MSchmoecker merged 1 commit intoOct 31, 2026
Merged
Conversation
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
enabled auto-merge
October 31, 2026 15:24
MSchmoecker
disabled auto-merge
October 31, 2026 15:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #497.
Since Valheim 1.0,
ButtonSfx.OnSelectplaysm_selectSfxPrefab(before 1.0 it was empty). With the default navigation mode, mouse down selects the button and mouse up firesonClick. Those two events are more thanButtonSfx's 2-frame guard apart. So every click that selects the button (in practice almost every click) playedsfx_gui_selectfollowed bysfx_gui_button.This removes the
m_selectSfxPrefabassignment fromApplyButtonStyle, 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 setButtonSfx.m_selectSfxPrefabon 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.