Implemented Music Looping


Game music looping has been implemented.

To make sure music has an intro part and a looping part working together, there are a few things required:

  • the music with intro needs to be cut, so that an intro clip can be played once and the looping clip can be played with looping turned on
  • use a coroutine to delay the looping clip, and don't use PlayDelayed, otherwise when pausing the game using timescale = 0, it doesn't delay, so the game would be buggy if you pause at the time the intro is playing
  • make sure when playing music, the first thing is to stop the current coroutines. If you need to stop a particular one, you need to store the reference in advance, otherwise just run StopAllCoroutines() on a MonoBehaviour
  • there is a unity plugin called introloop, which is supposed to do the job without cutting if you have a bit of money to spend
  • I tried to write some code to do so, and it turned out to be quite challenging, and I'm not sure about spending future time to maintain some Unity low level implementation

If you are using FMod, then just do the below:



References:

Get Contra is Back!

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.