Valheim
Install

Details

Last Updated
First Uploaded
Downloads
114
Likes
2
Size
16KB
Dependency string
LiveriaDevs-ValheimCursorLockFix-1.0.2
Dependants

Categories

ADDatHost Valheim hosting
30% off!

ValheimCursorLockFix

Client-side BepInEx 5 plugin for Valheim that keeps the hidden mouse cursor locked during gameplay. It unlocks the cursor when UI needs it, including the 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.

Install with r2modman local import

  1. Build the package with build.ps1.
  2. Open r2modman and select your Valheim profile.
  3. Go to Settings > Import local mod.
  4. Select dist/ValheimCursorLockFix-1.0.2.zip.
  5. Launch Valheim through r2modman.

Configuration

After the first launch, edit the generated config file:

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

Available options:

  • EnableFix - enables or disables the fix.
  • ForceLockInGameplay - forces Cursor.lockState = Locked and hides the cursor during gameplay.
  • UnlockInMenus - unlocks and shows the cursor in menus, inventory, build/piece menu, map, trader/store, text viewer, chat, console, text input, or when the window is inactive.
  • ToggleKey - default F8.
  • DebugLogging - enables extra log messages.

Toggle key

Press F8 in game to toggle the fix on or off. When disabled, the plugin releases the cursor and stops forcing the gameplay lock.

Troubleshooting

  • Make sure BepInExPack Valheim is installed and enabled in the same profile.
  • If the cursor still escapes, check that EnableFix and ForceLockInGameplay are both true.
  • If the cursor flickers in the screen center, update to 1.0.2 or newer.
  • If the cursor stays locked in UI, set DebugLogging = true, reproduce the issue, and check the BepInEx log for the detected cursor state.
  • If a Valheim update changes UI APIs, this plugin uses reflection-based safe checks to avoid crashes, but a compatibility update may still be needed for changed UI behavior.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.