How to Fade Between Audio Tracks [Unity Tutorial]

Поділитися
Вставка
  • Опубліковано 8 січ 2025

КОМЕНТАРІ • 43

  • @bicoders4215
    @bicoders4215 3 роки тому +6

    This Is Just What I Wanted I Knew You Will Gimme That.. Music Transistions was something i was searching for just 2 days ago and its good to be the first viewer

  • @CRUMVIII
    @CRUMVIII 3 роки тому +1

    Just wanted to say, I only subbed recently after watching a first video which helped me considerably but glad I did cos this one's another winner too. :)

  • @HarisLoufopoulos
    @HarisLoufopoulos 2 роки тому +1

    i am trying to make a sound game in unity and i am using different atmospheres, outdoors, underwater, cave ambiences...this guy really saved my project with this video, completely pro my friend !! subscribed and i want to see more from you !!

  • @madduckling4436
    @madduckling4436 3 роки тому +8

    hello comp-3 interactive I wanna thank you for all the videos you're making I'm really not the best in making games and I definitely suck at making games even tho I have great ideas...but your videos are helpful easy to understand and beginner friendly....THANK YOU ALOT MATE!!

  • @AliceRubyC
    @AliceRubyC 4 місяці тому

    You saved my skin with this, thank you so much!!

  • @sheldorinolive6100
    @sheldorinolive6100 3 роки тому +15

    Great tutorial! I realized that my audio wasn't looping, so I changed a chunk of your script from THIS:
    private void Start()
    {
    track01 = gameObject.AddComponent();
    track02 = gameObject.AddComponent();
    isPlayingTrack01 = true;
    SwapTrack(defaultAmbience);
    }
    to THIS instead:
    private void Start()
    {
    track01 = gameObject.AddComponent();
    track01.loop = true;
    track02 = gameObject.AddComponent();
    track02.loop = true;
    isPlayingTrack01 = true;
    SwapTrack(defaultAmbience);
    }
    By adding the "track01.loop = true;
    " and "track02.loop = true;" lines, the Audio Sources will loop. Hope that helps anyone who runs into the same issue. I learned a LOT from this video!

    • @FONORX
      @FONORX 2 роки тому

      This is a very useful supplement!

    • @SeaFoamStrat
      @SeaFoamStrat 2 роки тому

      Thank you so much for this!

    • @MDzayaJVF
      @MDzayaJVF Рік тому

      Deus te abençoe amigo, ajudou muito! ❤

  • @mendalosindiedevrpg8084
    @mendalosindiedevrpg8084 3 роки тому +1

    Thank you! exactly what I was looking for. gonna use this to swap between combat action loop and ambient music. keep it up

  • @SpyderLabGaming
    @SpyderLabGaming 7 місяців тому

    Simple and effective. Thank you!

  • @jtlewis81
    @jtlewis81 2 роки тому

    This was very helpful! I'm working on a 2D map that has 5 different "biomes", or terrain zones, each of which gets a different background soundtrack. Before looking up how to fade the audio, I already had setup the zones with polygon colliders as triggers, and I had the track swapping working, though it was abrupt. I thought that a coroutine would be the way to do the fade, and this little tutorial made it very easy. Thanks!

  • @throkgul
    @throkgul 3 роки тому

    Thank you sir, this helped me figure out how to swap audio when loading the game.

  • @PVJStudio
    @PVJStudio 2 роки тому

    yup hard cut etc annoyed much, this Awesome been search the methods for days, fantastic ty Dude :)

  • @Dylawa
    @Dylawa 2 роки тому +3

    I know I'm a year late, but I've followed this tutorial step by step, and I continue to get a missing semicolon error when editing the second half of the AudioManager code to insert the IEnumerator. When I try to put in the "missing" semicolon, I then get a syntax error where I'm being told I'm missing a ,.
    Has C# or Unity had any major changes since this tutorial that might be the cause of this? Because I've gone over this code line for line, and I can't find anything I have done differently.
    EDIT: after painstakingly saving step by step, I found that the issue is with the very last line typed: Comp-3 types "StartCoroutine(FadeTrack(newClip)0)", when it should be "StartCoroutine(FadeTrack(newClip));". Just for anyone else who was having a nightmare of a time like me.

  • @eldelnacho
    @eldelnacho 2 роки тому

    Beautiful video! thank you!

  • @LukaJankovic
    @LukaJankovic 3 роки тому

    Amazing tutorial, helped a lot!

  • @shiluram4063
    @shiluram4063 3 роки тому +1

    Love this

  • @420basco
    @420basco 3 роки тому

    this is amazing! thank you so very much

  • @MadMarcWinnipeg
    @MadMarcWinnipeg Рік тому +1

    Question:
    Do you have these scripts available for download or copy/paste?
    I just want to have a good look at it to understand it better and modify my scripts.
    Thanx
    Marc:)

  • @TFCau
    @TFCau 2 роки тому +1

    With the audio swap script its not working heres mine can u tell me whats wrong
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class AudioSwap : MonoBehaviour
    {
    public AudioClip newTrack;

    private void OnTriggerEnter(Collider other)
    {
    if (other.CompareTag("Player"))
    {
    AudioManager.instance.SwapTrack(newTrack);
    }
    }

    private void OnTriggerExit(Collider other)
    {
    if (other.CompareTag("Player"))
    {
    AudioManager.instance.ReturnToDefault();
    }
    }
    }

  • @brauliojorgealmeida
    @brauliojorgealmeida 2 роки тому

    Awesome! Thank you so much!

  • @demonking2526
    @demonking2526 3 роки тому

    Very helpful, thanks!

  • @MadMarcWinnipeg
    @MadMarcWinnipeg Рік тому

    Thanx man.
    Marc:)

  • @hex6206
    @hex6206 3 роки тому

    Awesome!

  • @Killaisking9999
    @Killaisking9999 Рік тому

    How would you loop the audio source?

  • @jazzy_rey
    @jazzy_rey 2 роки тому

    second audio is getting stuck and doesn't continue playing but when i go back to the other ambiance it works fine, i already got 2 days trying to fix it but there is no source out here to fix Unity's audio mistakes.

  • @AlexandrGlumov
    @AlexandrGlumov 3 роки тому

    Thank you! )

  • @monochromo81
    @monochromo81 2 роки тому

    Hi there. Thanks again for this. Do you see any way that we can use an "Audio Source" object instead of an "Audio Clip" in the Audio Swap? If adding a clip, there is no way to access audio settings (for example Volume or pitch) because the corresponding Audio Source object is created only in play mode, am I getting this right?

    • @BuffaloMuff
      @BuffaloMuff 2 роки тому +1

      Few simple things to let you handle that.Get rid of the instantiate, and add script to game object. Then make the 2 audio sources public. Then you can assign what audio sources you want and directly control all the options on them before hand.

    • @monochromo81
      @monochromo81 Рік тому

      @@BuffaloMuff Thank you very much. I will try this out.

  • @syedeahsanurrahman1670
    @syedeahsanurrahman1670 2 роки тому

    my default ambiance is not coming
    in my audio manager, i cannot find any section to place audio

    • @BuffaloMuff
      @BuffaloMuff 2 роки тому

      make sure its set to public.

  • @lukastomasek8038
    @lukastomasek8038 3 роки тому

    Great tutorial 👍

    • @bicoders4215
      @bicoders4215 3 роки тому

      comp 3 interactives tutorials are the best

  • @kerbi987
    @kerbi987 2 роки тому

    Uncle Bob would be sad and Tpikies also

  • @MohammadHashem-o8w
    @MohammadHashem-o8w 11 місяців тому

    discord mod

  • @TheFFireWasHere
    @TheFFireWasHere Рік тому

    Would be so cool if you get to the point real quick in the video

    • @NorcVI
      @NorcVI Рік тому

      You're the worst, he's explaining why he's doing things, so we can learn, instead of just copy pasting.

  • @ShakeyDBD
    @ShakeyDBD 2 роки тому +4

    top tier tutorial, thanks for this, subscribed.

  • @monochromo81
    @monochromo81 2 роки тому

    Great tutorial... Thank you!