You are viewing a potentially older version of this package. View all versions.
LiveriaDevs-ValheimCursorLockFix-1.0.3 icon

ValheimCursorLockFix

Client-side cursor lock fix for Valheim. Forces cursor lock during gameplay and unlocks it in menus, inventory, build menu, map, chat and console.

Date uploaded 3 weeks ago
Version 1.0.3
Download link LiveriaDevs-ValheimCursorLockFix-1.0.3.zip
Downloads 36
Dependency string LiveriaDevs-ValheimCursorLockFix-1.0.3

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2202 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.2202

README

ValheimCursorLockFix

Client-side BepInEx 5 plugin for Valheim that keeps the mouse cursor locked and hidden during gameplay, then unlocks it whenever UI needs it.

Features

  • Forces cursor lock during gameplay
  • Unlocks for main menu, pause menu, inventory, build/piece menu, map, trader/store, text viewer, chat, console, text input, and when the game window is not focused
  • Uses Valheim's ZCursor API and applies state in LateUpdate (after the game camera) to avoid fighting the game every frame
  • Chat stays unlocked while the chat input field is open, with a short sticky unlock so language / IME focus blips do not clear chat selection
  • Toggle in-game with F8 (configurable)
  • Reflection-based UI checks so a Valheim update is less likely to hard-crash the plugin

Install

  1. Install with r2modman / Thunderstore Mod Manager (BepInExPack_Valheim required)
  2. Or place ValheimCursorLockFix.dll into BepInEx/plugins/
  3. Launch Valheim through your mod manager

Config

BepInEx/config/ua.gyrocopter.valheim.cursorlockfix.cfg

Option Default Description
EnableFix true Enable or disable the fix
ForceLockInGameplay true Force locked / hidden cursor during gameplay
UnlockInMenus true Unlock / show cursor in menus and text UI
ToggleKey F8 Toggle the fix during play
DebugLogging false Extra BepInEx log messages

Troubleshooting

  • Make sure BepInExPack Valheim is installed and enabled in the same profile
  • If the cursor still escapes, keep EnableFix and ForceLockInGameplay both true
  • If the hidden cursor flickers, use 1.0.3 or newer
  • If chat selection drops when changing keyboard language / IME, use 1.0.3 or newer
  • If the cursor stays locked in UI, set DebugLogging = true, reproduce once, and check the BepInEx log for the detected reason

Notes

  • Client-side only
  • Safe to use on multiplayer as a local client mod

Changelog

See CHANGELOG.md.

CHANGELOG

Changelog

1.0.7

  • Keep the cursor visible and free while radial menus are open (emotes, item quick-select, etc.)

1.0.6

  • Chat keeps cursor hidden; restore chat focus after language/IME blips

1.0.5

  • Hard confine with Win32 ClipCursor + center when hidden

1.0.4

  • Fix false unlock from always-active UI roots

1.0.0

  • Initial release