Skip to content

Instantly share code, notes, and snippets.

@Partyschaum
Created July 26, 2026 13:03
Show Gist options
  • Select an option

  • Save Partyschaum/a98ffb0899f273aca4640aae4e478744 to your computer and use it in GitHub Desktop.

Select an option

Save Partyschaum/a98ffb0899f273aca4640aae4e478744 to your computer and use it in GitHub Desktop.
Guns 'n Goblins - Invert Y Axis Guide

Inverting Mouse Y-Axis in "Guns 'n Goblins"

The game has no built-in option to invert the mouse Y-axis, and editing the legacy Unity InputManager asset (e.g. via UABEA) has no effect — the game reads mouse input through Unity's new Input System in its own code, not through the legacy input axes. The only way to invert Y is to patch the game's compiled code (Assembly-CSharp.dll) directly.

The game is built with the Mono scripting backend (not IL2CPP), which means Assembly-CSharp.dll is a normal .NET assembly that can be decompiled, edited, and recompiled with a tool like dnSpy — no Unity project or SDK needed.

Requirements

  • dnSpyEx (the maintained fork of dnSpy — the original dnSpy project is no longer maintained). Download the Windows x64 build and unpack it anywhere.
  • The game installed via Steam (path used below): C:\Program Files (x86)\Steam\steamapps\common\Guns 'n Goblins Demo\Guns 'n Goblins_Data\Managed\Assembly-CSharp.dll

Steps

1. Back up the original file

Before changing anything, copy Assembly-CSharp.dll to a safe name in the same folder, e.g. Assembly-CSharp.dll.bak. If anything goes wrong, you can always restore this copy and start over.

2. Open the DLL in dnSpy

  • Launch dnSpy.exe (the GUI, not dnSpy.Console.exe).
  • File > Open and select Assembly-CSharp.dll from the game's Managed folder (important — dnSpy needs the other DLLs in that same folder to resolve references like UnityEngine.CoreModule.dll).

3. Find the relevant method

In the tree on the left, navigate to:

Assembly-CSharp.dll → cowsins (namespace) → InputManager (class) → Update() (method)

Double-click Update() to view its decompiled C# source on the right. Look for this line:

InputManager.mousey = Mouse.current.delta.y.ReadValue();

4. Edit the method

  • Right-click the Update() method and choose "Edit Method (C#)" — not the plain "Edit Method..." entry, which opens a metadata/flags dialog instead of the code editor.
  • Change the line above to add a minus sign, inverting the raw mouse Y delta at its source:
InputManager.mousey = -Mouse.current.delta.y.ReadValue();
  • Click Compile.

    If you get a compiler error like:

    CS0104 "Object" is an ambiguous reference between "UnityEngine.Object" and "object"
    

    it's unrelated to this change — it happens because the decompiled snippet is missing full type qualification somewhere else in the method. Find the offending line (it will reference Object.Destroy(...) or similar) and qualify it explicitly as UnityEngine.Object.Destroy(...), then compile again.

5. Save the patched assembly

  • File > Save Module... and save it back as Assembly-CSharp.dll in the game's Managed folder, overwriting the original (your backup from step 1 keeps you safe).
  • Close dnSpy so the file isn't locked.

6. Test

Start the game and check mouse look — moving the mouse down should now look up, and vice versa. The horizontal (X) axis should be unaffected.

Dead end to avoid

There is a field InputManager.invertedAxis (static bool) that looks like a ready-made invert toggle, and it is referenced in cowsins/PlayerMovement.cs:

int num = (InputManager.invertedAxis ? -1 : 1);

It's tempting to just set this to true (e.g. in InputManager.Awake()), and it does invert Y — but it also incorrectly inverts the X/horizontal axis, because the same num value multiplies both the X and Y rotation formulas. It's effectively dead/unfinished code in the game and not usable for a Y-only invert. Patching mousey directly at the source (step 4 above) is the correct, isolated fix.

If the game updates

Steam may overwrite Assembly-CSharp.dll with the original, unpatched version on a game update, which reverts this fix. If mouse invert stops working after an update, just repeat steps 1–6 above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment