Audio with ECC - LeeTwentyThree/ECCLibrary-Legacy GitHub Wiki

Information on including your own custom audio.

  • ECC uses Unity's audio system.
    • This audio system does not work very well with Subnautica.
    • However until we find out how Subnautica handles sound we will have to do this.
  • On the bright side, Unity's audio system is very easily compatible with AssetBundles.
    • Simply include any audio files related to the mod in the Asset Bundle.
      • Multiple audio files used for the same thing, for example Idle sounds, should all start with a common prefix.
        • For example: FishIdle1, FishIdle2, FishIdle3
      • There should not be two audio clips with the same name.

Using the ECCAudio class

The ECCAudio class helps with caching audio clips at patch time and grabbing them at runtime. There are a few basic functions you will use related to this.

  • ECCAudio.RegisterClips(AssetBundle assetBundle): registers all audio clips from the given AssetBundle into ECC. Should be done while patching. Certain creature behaviors, including the RoarAbilitySettings override, require clips to be registered to work properly.
  • ECCAudio.CreateClipPool(string startingLetters): returns a new clip pool, filled with ALL registered clips that has a name that starts with startingLetters.
    • For example, ECCAudio.CreateClipPool("FishIdle"); may return a clip pool containing the following AudioClips: FishIdle1, FishIdle2, FishIdle3.
  • LoadAudioClip(string name): simply loads an audio clip by the given name.

Simple steps to get basic audio support

  1. Include the AudioClips in your AssetBundle
  2. Build the AssetBundle and move it into the Assets folder.
  3. In your patch method, after loading the AssetBundle, simply call ECCAudio.RegisterClips(assetBundle);
  4. Use the RoarAbilitySettings override to add idle sounds.

Visual example of how audio should be setup in unity: