Simple Mod Menu + Cheat codes for PC Unity game

Sbenny.com is trusted by 1,326,219 happy users since 2014.
Register

AndnixSH

Savage Lv6️⃣
SB Mod Squad ⭐
Member for 8 years


Video preview:
Mod menu for PC - Streamable

I made it for fun, It’s not for Android lol
Download source code: AndnixSH/UnityModMenuPC

You can use the code whatever you want without crediting to me. It’s not copyrighted or licensed

Please note, you must have basic knowledge of C# and Unity. I won’t explain everything in it.
And don’t forget the read everything, being lazy to read and skipping will cause yourself to do bad things. And if you still have question after fully reading, just ask
.

Using Unity editor to customize and test:
It’s better to customize it in Unity editor and test. You can edit code while the scene is playing

First, create an account or sign in with Google or Facebook at Unity
Go to Store - Unity Store and select "Try personal". It is completely free. Download and install it. If you like to have Visaul Studio 2017 installed, make sure to select it in installer. If not installed, you will use MonoDevelop.

Launch Unity, login with your account and complete your survey. After that you can create a new project. Name it you want and keep 3D selected and disable Unity Analytics. Click "Create project"

To add the existing script, simply drop the .cs file on Protect/Assets section

Everything are explained in source code

It’s recommended to create MOD Menu script each games you want to mod like I do so you have your scripts ready for modding:

How to add mod menu into the game:
This is a tricky part because you need to find classes that are active. it’s hard to find, but there are ways to find out and add OnGUI.
- Known active classes are UIRoot, UIDrawcall, SoundManager, AudioManager, Loading classes etc... The best are SoundManager, AudioManager or something similar
- Search for any "Start" or "Awake" method, add this code and change first number +50 each Classes that have "Start" or "Awake" method to find out what classes is active and best

C#:
void OnGUI() {
GUI.Button(new Rect(0,0,200,50), "FirstClassName");
}
C#:
void OnGUI() {
GUI.Button(new Rect(50,0,200,50), "FirstClassName2");
}
C#:
void OnGUI() {
GUI.Button(new Rect(100,0,200,50), "FirstClassName3");
}
If the button is too dark, that’s a bad class.

In this case, i’m modding Baldi’s Basics and added OnGUI to PlayerScript, PlaytimeScript and ScoreScript. Only 1 button “PlayerScript” appear on screen so we know it’s an active class



If you found a good active class that isn’t bad, you can start adding MOD Menu

Right click on empty namespace and click Add Class...

1540573696726.png


Add your whole code. Make sure the OnGUI() and Update() is “public static” so other classes can access the fields. Click Compile

dnSpy can't find class you created so you have to save the assembly as Assembly-CSharp.dll in Managed folder. Unload Assembly-CSharp.dll and reload Assembly-CSharp.dll file

Now call OnGUI and Update on active class to your MOD Menu

On active class, if OnGUI() or Update() does not exists, just edit one of method and add new method above or below existing method:

C#:
public void OnGUI()
{
    YourModMenu.OnGUI();
}


If OnGUI() or Update() exists, edit it and only add
C#:
YourModMenu.Method();


Hacking functions with mod menu
Now search some functions to hack. If you had added OnGUI in an existing class with Instance method, modify the code like this:
In this case, I modify getter method

C#:
public float ArmorCapacity
{
    get
    {
        if (YourModMenu.toggle1)
        {
            return 999f;
        }
        return this._armorCapacity;
    }
}
And In void
C#:
private void Success()
{
   if (YourModMenu.toggle2)
   {
       if (this.jumps >= 10)
       {
       // success code
       }
   }
   else if (this.jumps >= 5)
   {
   // success code
   }
}


There are many ways to modify

Save the dll file and test your MOD Menu

Good luck :)

Preview:
I use Baldi’s Basics as an example because it’s quickest way to test MOD Menu
 

Tigress

~ Hack Genius ~
✔ Approved Releaser
Member for 5 years
Thanks so much for the Tutorial.
 
Top