Have you ever wanted custom sounds in any Unity Game? You're in luck, let me show you how.
Part 1: Download all needed parts
You will need these programs:
-
Unity 2022.3.12f1 Download it here
- You'll need unity to create your own resource files, which you can then use to replace the current sounds in your unity game.
-
UABEAvalonia Download it here
- You'll need UABEA to edit asset files of your game, or any other unity game. This allows you to link a given asset to a different resource.
To install Unity, follow the download link, then simply press “Unity Editor Windows”, or whatever operating system you are using. After downloading, unity will install Unity Hub, which will require you to create an account, and then download the actual unity editor. After all this is done, Unity is installed.
To install UABEA, follow the download link, scroll a bit down, and click on a file that says uabea-windows.zip or anything similar. You will need a program like 7-zip or WinRAR to extract this zip. Make a new folder on your desktop, name it however you want, and then drag all the files from inside the zip into the folder.
Part 2: Scope out your files using UABEA
Open your game's game files
Open Steam. Click “Library” on the toolbar, and then search for your game (or any other unit game) on the left panel. Right click it, and press “Browse Local Files”. When a file explorer window opens, open the folder 📂Your_data. Then, right-click the address bar at the top of file explorer, and click “Copy address as text”.
Start UABEA and open the asset file
- Go into the folder with the extracted UABEA files from the previous part. Double-click the file named UABEAvalonia.exe, which should have a white and pink icon.
- Click on “File”, and open. Now, click on the empty part of the address bar, and paste in the path which you copied in the previous step, then press enter.
- Search for a 📁resources.assets file. Double click it.
A new window should be opened, which lists all the resources in the game.
![tutorial showing how to open an assets file in UABEA](https://res.cloudinary.com/practicaldev/image/fetch/s--5fGS46Hx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/exn5mts5cnvbt4r3jmsq.png)
Look for files of interest.
- Click on the “Type” column, which will sort all the files by type. This will help you find AudioClips;
- Now, find them by names! You need to do some guessing, for example, missile warning is of course going to be called missileWarning, but some names might be less intuitive.
If you wanna quickly preview the assets, you can use AssetRipper, which allows you to view them live and export them, but it cannot use assetripper to modify resources.
<li>Check if they're the files you're intending to replace, and note their names. </li>
Part 3: Make your replacement assets in Unity
- Open Unity Hub. Go into Projects and press “New Project”. Make sure to select 3D (Core). Name it whatever, and select a unity cloud organization. Feel free to uncheck Connect to Unity Cloud, so your game isn't backed up to the cloud. Once your editor opens, you might see several panels. There should be a Project/Assets panel at the bottom.
- Drag your audio files into the bottom file panel. Make sure to name them exactly as they are named in the asset files, so you can overwrite them.
- From the bottom panel, drag the files to your scene.
- After this is done, save and compile your game. Go into File > Build Settings, Select Windows as the target platform, and press “Build”. A folder picker window will open, create a new folder and name it anything you want, like builds, and select that folder.
The game and its assets will now build into that folder.
Part 4: Create dumps
Look in the folder you just created, and compiled into. There should be a gameName_data folder. Open it. Your files of interest are 📂sharedassets0.assets, and 📂shareassets0.resource. The .assets file stores the references to resources, the .resource file stores the actual resources (audio files).
- Using UABEA, open the 📂sharedassets0.assets file. Find the resources you want to export, and on the right side, press “Export Dump”. You can choose whether to export the dump as .json or as .txt
- Since there is already a sharedassets0.resource file in your game's data, rename it to anything you want, like ResourcePack.resource or just like mash your keyboard.
- Open the dumps in a text editor. You will need to edit the m_Source field to have the name of your .resource file, which you just renamed in the last step.
Part 5: Modify your game's asset files.
Now you'll need to modify your game's 📂resources.assets file, so the resources point to your custom resources, in your custom .resource file.
- Drag your custom .resource file into 📂YourGame_data
- Create a backup of your resources.assets file. Copy and paste it to make a copy, in case you mess stuff up (you will).
- Open the 📂resources.assets file in UABEA again. Find the assets you need to replace. Press on it, press “Import Dump”, choose whether you are importing .json or .txt, and import. Make sure you have edited the asset names and asset source before importing them into UABEA, as using “Edit Data” in the program likes to mess up the assets.
- Save the assets file by doing File > Save.
Top comments (0)