Modding is not officially supported. Take backups of game and save files before modding. Do at your own risk.
Updated:
You can use C# and Mod Loader to load AudioClip using Unity's WWW -class. Here is an example taken from my Recorder Flute -mod:
To replace existing sounds, you need to find the according AudioSource that holds the clip you want to replace. There is many way to acquire it; one approach could be scanning through all AudioSources with foreach -loop and check if the clip name of AudioSource matches to one you are replacing.
Pseudo-Example:
OUTDATED METHOD:
Needed programs:
- Unity
- Unity Asset Bundle Extractor
- Soundfile (.wav)
- Notepad
Use Unity Asset Bundle Extractor to find an AudioClip to replace from mysummercar_Data/sharedassets2.assets. Rename your .wav file with that name.
1.) Open Unity and make new project.
2.) Copy your .wav file to your projects Assets/ -folder.
3.) Add a new GameObject to scene and add Audio Source component to it.
4.) Drag & Drop your .wav file to AudioSources AudioClip -field.
5.) In File -> Build Settings, add your scene to build and click Build to build your project somewhere.
6.) Find your buildedprojectname_Data/ and files "sharedassets0" and "sharedassets0.assets.resS" (it name may be sharedassets0.resource too) .
7.) Rename "sharedassets0.assets.resS" file anything you want (for ex. "hayosikosounds.resource") and copy it to mysummercar_Data/ -folder
8.) Use Unity Assets Bundle Extractor to Export your AudioClip to 'Dump' from buildedprojectname_Data/sharedassets0.assets file.
9.) Open the Dump file in Notepad and find following line: 1 string m_Source = "sharedassets0.assets.resS" and change that to point your resource file ("hayosikosounds.resource").
10.) In Unity Assets Bundle Extractor, open mysummercar_Data\sharedassets2.assets file and find the original AudioClip
11.) Click "Import Dump" and select file you previously extracted
12.) Use File -> Mod Maker -> Create standalone .exe installer to create installer and save it to MSC root folder
13.) Run installer.
Let me know if there are succes or problems with this, or is this readable at all...
Updated:
You can use C# and Mod Loader to load AudioClip using Unity's WWW -class. Here is an example taken from my Recorder Flute -mod:
Code:
// Load .wav file using WWW -class.
WWW RecorderSound = new WWW("file:///" + @Path.Combine(ModLoader.GetModAssetsFolder(this), "g5.wav"));
while (!RecorderSound.isDone) { }; // Wait sound to be loaded.
// Add clip to recorder flute.
RecorderPivot.GetComponent<AudioSource>().clip = RecorderSound.GetAudioClip(false);
To replace existing sounds, you need to find the according AudioSource that holds the clip you want to replace. There is many way to acquire it; one approach could be scanning through all AudioSources with foreach -loop and check if the clip name of AudioSource matches to one you are replacing.
Pseudo-Example:
Code:
foreach(AudioSource audio in GameObject.FindObjectsOfType<AudioSource>())
{
if(audio.clip.name == "ClipToReplace")
{
// Load .wav file using WWW -class.
WWW NewSound = new WWW("file:///" + @Path.Combine(ModLoader.GetModAssetsFolder(this), "g5.wav"));
while (!NewSound.isDone) { }; // Wait sound to be loaded.
audio.clip = NewSound.GetAudioClip(true); // Change clip to AudioSource
}
}
OUTDATED METHOD:
Needed programs:
- Unity
- Unity Asset Bundle Extractor
- Soundfile (.wav)
- Notepad
Use Unity Asset Bundle Extractor to find an AudioClip to replace from mysummercar_Data/sharedassets2.assets. Rename your .wav file with that name.
1.) Open Unity and make new project.
2.) Copy your .wav file to your projects Assets/ -folder.
3.) Add a new GameObject to scene and add Audio Source component to it.
4.) Drag & Drop your .wav file to AudioSources AudioClip -field.
5.) In File -> Build Settings, add your scene to build and click Build to build your project somewhere.
6.) Find your buildedprojectname_Data/ and files "sharedassets0" and "sharedassets0.assets.resS" (it name may be sharedassets0.resource too) .
7.) Rename "sharedassets0.assets.resS" file anything you want (for ex. "hayosikosounds.resource") and copy it to mysummercar_Data/ -folder
8.) Use Unity Assets Bundle Extractor to Export your AudioClip to 'Dump' from buildedprojectname_Data/sharedassets0.assets file.
9.) Open the Dump file in Notepad and find following line: 1 string m_Source = "sharedassets0.assets.resS" and change that to point your resource file ("hayosikosounds.resource").
10.) In Unity Assets Bundle Extractor, open mysummercar_Data\sharedassets2.assets file and find the original AudioClip
11.) Click "Import Dump" and select file you previously extracted
12.) Use File -> Mod Maker -> Create standalone .exe installer to create installer and save it to MSC root folder
13.) Run installer.
Let me know if there are succes or problems with this, or is this readable at all...
Last edited: