How to mod textures and audios on Unity games (Baldi's Basics)

Just found some tutorials how to mod textures of Baldi's Basics.

There are thousands of funny mods of Baldi's Basics around the internet. My favorites are Playtime's Swapped BasicsBaldi's Basics SUPER FAST EDITONMario's World in 16 Bits and many more XD. I'm a big fan of Baldi's Basics lol

Video tutorials:




Text Tutorial:
Credit: lambTuberXtream72

1. HOW TO MOD BALDI'S BASICS
Everyone's been requesting me to make some kind of tutorial on how to mod the game. Well, I suck at making tutorials, so I'll just make this text guide. So here's how I do it.

1.1. Texture Mods
To modify textures, you're going to need to download UABE (Unity Assets Bundle Extractor). It's IMPORTANT that you get the correct version by using the link below. Otherwise it will NOT work.

https://github.com/DerPopo/UABE/releases/download/...

Once you have UABE up and running, make a copy of your Baldi's Basics directory that you can use to mod the game. In UABE, in the top left, click File, and then Open. Then navigate to the Baldi's Basics copy you just made, and go to the folder called BALDI_Data. Now there are 4 files (5 if you're modding versions 1.3 and up) that you can open in this directory: sharedassets0.assets, sharedassets1.assets, sharedassets2.assets, sharedassets3.assets, and sharedassets4.assets (plus sharedassets5 if on versions 1.3 and up). Before you open these however, if you're modding a version that's 1.3 or greater, a window will pop up upon opening a .assets file saying that you're trying to edit and unknown database type, and you'll get a whole list of Unity versions. If you get this, scroll all the way down, click the last one, and then press OK. Anything else will NOT work. Now, you're probably wondering what all of the sharedassets files contain, so I'll sort it out for you:

sharedassets0 - Default Unity stuff, no need to go here.

sharedassets1 - The title screen.

sharedassets2 - Literally everything that you find in the school. This is the most important one out of them all.

sharedassets3 - The random objects that appear after a game over.

sharedassets4 - The win screen. (There's only one texture in this one.)

sharedassets5 (1.3 and up) - Secret ending assets.

Now the question is, how do you modify the textures? Well, I'm getting to that. The first thing you need to do is sort all the assets in this new big window by type. At the top, there's a button somewhere that says "Type." Around there, you'll also see a button that says "Name." Click on "Name" first, and then click "Type." Everything in the window is now sorted by type, but also alphabetically, since you clicked on "Name" first. This will help A LOT. As you can see, the asset types are in that column below the word "Type." You may have noticed that each sorting option is separated by lines. If the column is too small for you to be able to read the file types, click on one of the lines next to the "Type" option and drag it out so you can see.

This next step is important. Now that you have everything sorted, click on the very first thing that you see with the type "Texture2D." Then scroll down until you find the very LAST thing with the same type. Now you have to hold down SHIFT and then click that. Everything should now be highlighted blue. Now don't click ANYTHING else in that list, or else you will deselect all of those textures. Next you have to make an empty folder, and name it something (preferably the same name as the sharedassets file you're editing for convenience's sake). Go back to UABE, and then on the far right, click the button that says "Plugins." Another window will pop up. Click on "Export to .png," and then press OK. The explorer window should pop up now you need to click on the folder you just made ONCE so it's highlighted in blue. Then press select folder. A loading bar may briefly come up. Once it's done, go to your folder, and ALL of the textures in that sharedassets file should be there. Make sure you don't modify ANY of the filenames, or else you won't be able to import them back into the game.

Now you're able to edit the textures. You'll need some kind of image editor that supports transparency, and preferably can open up multiple files at the same time. I use paint.net, since I can put all of the textures into one window and scroll through them at the top. You can download with the link below. You may also need Microsoft .NET Framework 4.7.1, so I'll put a link to that too. You'll have to look up a tutorial on how to use paint.net, since I won't be explaining it here. But you don't have to use paint.net, you can use something else like Photoshop. Although if you do use paint.net, if the save screen comes up and the type at the bottom says .pdn, make sure you change that to .png.

https://www.dotpdn.com/files/paint.net.4.0.21.inst...

https://www.microsoft.com/en-us/download/confirmat...

When editing textures, try to make them line up with the existing sprite as best you can. Then, get rid of the existing sprite and keep the new one (assuming they're on separate layers). You want to do this so you can prevent cropping issues with the texture, since anything too much outside the range will get cut off. Once you've finished editing your textures, save everything. Now it's time for the fun part: putting them into the game! Putting the textures into the game is similar to exporting them, so it's not that hard. Go back to UABE, and then highlight all of the textures with the method I mentioned earlier. Click Plugins, choose Batch Import, and then press OK. The explorer window will show up again. Just like before, click your folder, press select folder. A window should come up telling you what files will be replaced. Don't modify anything in there, and just press OK. All of your textures will be replaced after it's done. Next go to File, and then Save. The explorer window will come up once again. Now go to your Baldi directory, but don't save this in BALDI_Data, since you can't overwrite asset files in UABE. Save it in the main folder. Then close out of UABE (it's important that you do this or else this next step won't work). Go to the explorer window, and then go into BALDI_Data. Copy the original asset file you just made, and paste it in the main directory. Then rename it to something like "sharedassets2 (backup)". Then drag the modified sharedassets file into the BALDI_Data folder. Windows will ask you if you want to replace the file. Click "Replace the files in the destination," and then once it's done, launch the game. If the custom textures show up, then congratulations! You did everything right! If some textures show up incorrectly, Then you can just go back to the folder with all of your textures, modify them, and then reimport with UABE, and create another sharedassets file. If you already deleted the folder with your textures, you can restore them from the recycle bin, assuming you didn't empty it.

1.2. Modifying Sounds
Modifying sounds is A LOT harder than modifying textures. You actually need to install Unity to modify the sounds. If you feel like doing this and have some extra space on your hard drive, you can download it using the link below. You'll have to make an account first though.

https://store.unity.com/download/thank-you?thank-y...

When Unity is installed, this next step is a bit tricky. Go back into UABE, and go to the sharedassets folder once again. Do the type sorting thing again, but this time select all of the files that have the type "AudioClip" using the previous method from earlier. Go to Plugins, click Export to .png, and import them into a folder. You should now have the files from the sharedassets folder. These will be important for later. Now you're going to need some kind of audio editor to make sounds. Personally, I use Vegas Pro 13, but that costs money, so here's a link to Audacity. Just like paint.net, I can't really teach you how to use this, so you'll have to look up a tutorial.

https://www.fosshub.com/Audacity.html/audacity-win...

You'll have to find a sound to add into the game. If you want to get sounds from YouTube, use this tool:

convert2mp3.net - Online Video converter - Convert Youtube, Dailymotion, Vevo, Clipfish and MyVideo videos online to MP3, MP4 and more formats

Once you've downloaded your sound, go into Audacity, trim the audio (I can't teach you how to do this, as I suck at using Audacity. You'll have to look up a tutorial) and then go to file, and then click Export Audio. Now this next step is important. Open up a separate explorer window, and go to your folder with your extracted sounds. Copy the name of the file that you want to replace. Then go back to audacity, and paste the name of the file and use it as the name as the exported sound. Make sure to save it in a separate folder so you don't overwrite the original sound.

Now here comes the juicy (and probably the hardest) part. Remember when you downloaded Unity? Well, I wasn't kidding. You actually need it. Open up unity, and make a new project. Once the project loads and comes up, drag the sounds into the blank space at the bottom, and they should appear. Then highlight them, and drag them into the 3D display up at the top with the camera and the sun. Then go to file, and click Build Settings. A window should pop up. You don't want to mess with anything there, so just click Build. An explorer window will pop up. Within that window, create a new folder, preferably named something like "test," and go into it. Then name the executable the same thing as the folder, and click save. Once Unity is done making the .exe file, close out of Unity. Next open up UABE, click File, and then Open. Now, navigate to the new folder you just made. Go to the data folder of the .exe that Unity built, and open up the only sharedassets file in there. If you get a message saying the database doesn't match the player version (numbers here), just click on U5.5.0f3 in the list, and then press OK. It's important that you click that one, or else it won't work.

Now that you're in UABE, use the same method from earlier to select the assets, but this time, click Export Dump. If you get a message asking what type of dump you want to make, just press OK and don't change anything. An explorer window should pop up. Make another folder in there, and name it something like "Dumps." If you're exporting multiple files, which you might be, click on it once, and then press select folder. Everything should be imported there. Now don't close UABE, just minimize it.

Now, unless if you want this process to take a million years, for this next part, you're going to need Notepad++. You can download it here:

https://notepad-plus-plus.org/repository/7.x/7.5.6...

Once it's installed, before you open it, go back to your data folder that Unity built. You'll see a file in there called sharedassets0.resource. not .assets, but .resource. Copy that and put it in your dumps folder. Now you NEED to rename it to something else, since Baldi's Basics already has one. I like to make it something like "sounds." If I need multiple, I just put a number at the end. Now we have to open Notepad++. Once it's open, highlight all the dump files, and drag them into Notepad++. This will open all of them at once in the same window. At the top, click Search, and in that list, press Replace. In the "Find what" box, type in "sharedassets0.resource" (without quotes). Then in the replace with box, type in "sounds.resource" (or any other thing. Just make sure .resource is at the end). Then on the right, click "Replace All in All Opened Documents." This will replace any reference of that old file with the new resource file in ALL of the dumps at once. Now you have to go to file, and click Save All. Go to file again, click close all, and then close Notepad++. Before we can import the dumps into Baldi's Basics, you NEED to get rid of the extra text at the end of the file. It looks something like this: "(text not to remove)-sharedassets2-444" Just get rid of the -sharedassets2-444 thing at the end so it ONLY has the sound clip name. Otherwise it will not be imported. After doing that, THEN we can import the dump files into Baldi's Basics.

Before you open UABE, take the dumps folder, and put it in the BALDI_Data folder. Go into the dumps folder, and drag out the sounds.resource file into the BALDI_Data folder. Now go back to UABE, and open the sharedassets file that you've been trying to edit. Select all of the AudioClip assets with the same method from before, and then click "Import Dump." Now click on the dumps folder, and then press select folder. A window may come up. If it does, just press OK. Then a loading bar will come up. Once it's done, go to File, and click Save. Just like before, save it in a different directory, close out of UABE, and then drag it into the BALDI_Data folder. Then launch the game. If the sounds work, then great job! You've just completed probably the hardest thing to do when modding Baldi's Basics! After you're done, you can delete the folder that contains the .exe file that Unity built, and the dumps folder with all the text documents. Just don't delete sounds.resource, or you'll lose all your sounds.

1.3. Changing the game's code itself
Changing the game's code is a bit more complicated, as there really isn't much explaining to do. It's just more of experimentation. To change the game's code, start out by installing dnSpy with this link:

https://github.com/0xd4d/dnSpy/releases/download/v...

Once it's been installed, launch it. In dnSpy, click on File, and then Open. Now go to your Baldi's Basics directory, go to BALDI_Data, and then a folder called Managed. In there, you'll see a whole bunch of .dll files. Open the one called Assembly-Csharp.dll. Once you've got it in the list, click the little arrow that's right next to its name to drop down the contents in the file. You may need to do this twice. Once you see 3 files called PE, References, and "-," drop down the file literally called "-". This contains all of the scripts that the game uses for NPCs, mechanics, etc. If you want to edit one, click one one, and in the window on the right, right click somewhere where there's text, and click Edit Module."Another window will pop up, this time with the text editable. Edit the code, and then press Compile. Not that you can't save if there are errors in the code. You can look at the errors at the bottom, and view what line they're on if there is. Now this is rare, but if for some reason code editing doesn't work, you can also press Edit Class instead of Edit Module. The only difference is that this contains ALL of the scripts in one big window, so make sure not to accidentally modify those, and just edit the one that you intend to edit. Then click Compile to apply the code. If you still can't edit the code even with those buttons, try using "Edit IL Instructions." This will allow you to edit some files that will have errors no matter what you do. Of course, make sure you press Compile when you're finished.

Now that you've edited the game's code, go to file, press Save Module, and then press OK. Launch the game, and check to see if your edited code worked. If it didn't work, you'll have to just experiment more with dnSpy until you get the code working.

1.3.1. The End
This is the end of the guide. This took me a REALLY long time to type this up, but I hope this helps you!

Kommentarer