PLEASE use a Unity SOUND MANAGER! - Full Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ม.ค. 2025

ความคิดเห็น • 46

  • @Equisdeification
    @Equisdeification 6 หลายเดือนก่อน +14

    Nice video! A simple dictionary of that you create at runtime feels much easier to read. Also be careful with having all your sounds in a single script, specially on mobile, because if the game grows, this means having all the game audio loaded into memory from the start, even sounds that you don't even need in the current scene

    • @radiofloyd2359
      @radiofloyd2359 2 หลายเดือนก่อน

      Is there no way to replace the audio clips with pointers to them until a given condition is hit?

  • @blindsidedgames
    @blindsidedgames 8 หลายเดือนก่อน +2

    Man, I didn't know I could reference instanced non static methods that way. Works with variables too I like that. You taught me much today Senpai.

    • @Mustan__g-l1i
      @Mustan__g-l1i หลายเดือนก่อน

      that senpai part is so cringe

  • @alicia8382
    @alicia8382 8 หลายเดือนก่อน +1

    this is such a good tutorial, seriously so helpful! love how you structure the video and actually show the features you're talking about at the START of the video. it helps so much to know if this tutorial is something i'm looking for. super easy to follow! thanks for sharing this for people like me to learn and follow along for free!!!

    • @SmallHedgeHQ
      @SmallHedgeHQ  8 หลายเดือนก่อน +1

      Thank you so much!!

  • @thewolf2296
    @thewolf2296 หลายเดือนก่อน

    Thank you mate! This is definitely a manager I am going to add in my game and the future ones! Big up to you 🙌

  • @AlirezaR5
    @AlirezaR5 4 หลายเดือนก่อน +2

    looks cool. definitely be using it

  • @HarrenTonderen
    @HarrenTonderen 8 หลายเดือนก่อน +2

    Nice!
    Btw one thing i like to add with audio players is random pitch - usually storing it as Vector2 (so X/Y are min/max, 1f/1f as default) and change AudioSource's pitch with random range when play function is called.
    Small but fun thing, however unsure how it affects perfomance in any case..

    • @SmallHedgeHQ
      @SmallHedgeHQ  8 หลายเดือนก่อน

      That is a great idea! It would definitely make the sounds feel more authentic.

  • @NightRunStudio
    @NightRunStudio 3 หลายเดือนก่อน +1

    Learned a couple of neat tricks here. Thanks for the helpful video!

  • @kenknudsen675
    @kenknudsen675 22 วันที่ผ่านมา +1

    This is fine for managing 2D sounds - like in your side scroller example - but what about 3D sounds? How does this deal with sounds that are localized to objects moving through a 3D scene? When an airplane flies over for instance, the sound should get louder and move across the scene as it approaches, and Doppler shift as it passes. I just find it easier to put a sound source on the moving object, and let the Unity audio manager handle it, than to manually process each sound clip to fake all of that. So this approach may not work as shown in every use case.

    • @SmallHedgeHQ
      @SmallHedgeHQ  19 วันที่ผ่านมา +1

      That’s an incredibly crucial distinction to make. This particular sound manager utilises one shot/instant sounds at a specific volume. This script can be tweaked to include a Transform and 3D float parameter so it spawns a gameobject with an audio source attached under the parent Transform. Then start a coroutine that lasts until the end of the audio clip duration, then it destroys itself.

  • @Anerisian
    @Anerisian 9 หลายเดือนก่อน +1

    This seems really good, but I think the soundlist step, if not the enum should be scriptable objects.

    • @SmallHedgeHQ
      @SmallHedgeHQ  9 หลายเดือนก่อน

      Yeah, an array of scriptable objects would also work.

  • @sankgoku
    @sankgoku หลายเดือนก่อน

    Nice video great Sound Manager script and explanation

  • @theswiftbuilds
    @theswiftbuilds 9 หลายเดือนก่อน

    this is awesome, i wish i knew this earlier! you earned a sub :)

  • @rofu8096
    @rofu8096 9 หลายเดือนก่อน +3

    I FOUND A FUCKING GEM THANK YOU GEM

  • @jaulloa21
    @jaulloa21 8 หลายเดือนก่อน +1

    The light flicker asset is simply a spotlight that dims on and off. :} 😅

    • @SmallHedgeHQ
      @SmallHedgeHQ  8 หลายเดือนก่อน +1

      xD. I should ask the developer to add more features! Its selling point is it’s completely customisable. You can flicker colour, flicker materials, add sound, and trigger events all in just one state. You can add an infinite amount of these states that do anything you want. I genuinely use this asset in most of my projects because of how versatile it is! Would recommend checking out the tutorial video on the Unity Asset Store to see all the features :)

  • @Ririroa
    @Ririroa 2 หลายเดือนก่อน

    whats the success thing
    how do i hace to make it work?

  • @LotionSoronarr
    @LotionSoronarr 8 หลายเดือนก่อน +2

    Why not use Scriptable Objects? Sounds lists in scriptable objects. Every characters gets it's own sound list.

    • @weckar
      @weckar 8 หลายเดือนก่อน

      Depending on application. This is more generic, and requires fewer additional assets as overhead.

  • @kunal-ko
    @kunal-ko 9 หลายเดือนก่อน

    You're a genius

  • @im0genim0gen46
    @im0genim0gen46 2 หลายเดือนก่อน

    how can i change the time where my sounds start , for example if i want to Play a sound but starting at 2 seconds in the sound not from the start .

    • @dalenesbitt2491
      @dalenesbitt2491 8 วันที่ผ่านมา

      The easiest way I found for stuff like this is to trim the clip using "Audacity" just drag and drop your audio in. You can loop it, cut it, past it, duplicate it, merge it - whatever. Then just export it straight back into your asset folder. Done

  • @msmigs1173
    @msmigs1173 2 หลายเดือนก่อน

    What if i don't want to choose a random sound and just want to have multiple i can choose from?

    • @radiofloyd2359
      @radiofloyd2359 2 หลายเดือนก่อน

      You can simply create different methods for the manager that will look for different sounds in different ways.
      Example: playRoundRobin()
      playIndex()
      playName()
      playClip()
      Etc.
      The implementation is quite simple.
      Round robin needs only to have the index increment and then modulo the list size.
      Index needs an index integer (might wanna modulo the list size just in case)
      Name would want to find the clip name within the array (slow but you can make it so that it keeps it in inventory until told to get a different one, to make it O(1) on subsequent calls
      Clip would just make it so it doesn't read the sound manager's list at all and just plays what you give it, OR you could have it check if the clip is contained within the manager and play it if it is.

  • @pablovillegas2898
    @pablovillegas2898 5 หลายเดือนก่อน

    Nice video but i have a problem, How can I lower the volume of the walking sound independently?, my walking sound is very loud and I would like to decrease it without altering the others

    • @SmallHedgeHQ
      @SmallHedgeHQ  5 หลายเดือนก่อน

      I actually found this exact issue! On the GitHub link, you can now change each sound volume in the Unity inspector, as well as its audio mixer. So the sound manager shown in the video is a little bit outdated.

    • @pablovillegas2898
      @pablovillegas2898 5 หลายเดือนก่อน

      @@SmallHedgeHQ Oh, ok i'll try it

    • @radiofloyd2359
      @radiofloyd2359 2 หลายเดือนก่อน

      Although I see that the fix was implemented on the code, I do think, as an audio producer first and foremost, that it's best to properly batch normalize the audio on audacity before trying to implement it (maybe even slightly mastering it as well). It's generally better practice to have every sound file be uniformly functional from the get go than tweaking each individual sound.

  • @ParisLuHv
    @ParisLuHv 10 วันที่ผ่านมา

    for anyone making a 3D game, specifically XR, find another solution. this is great for small scale games, and some parts of it are applicable to larger projects. but imo, its not the greatest solution for something like an FPS, RPG, dungeon crawler, rogue-like, etc.

  • @darkman237
    @darkman237 8 หลายเดือนก่อน

    Could you refactor this to use unity events?

    • @SmallHedgeHQ
      @SmallHedgeHQ  8 หลายเดือนก่อน

      100%. The only prerequisite is the Play() method can not have more than 1 parameter. Could potentially create a scriptable object which holds Sounds enum and Volume, then pass in that.

    • @darkman237
      @darkman237 8 หลายเดือนก่อน

      @@SmallHedgeHQ In order to keep the sound enum and volume would have to be set dirty between plays

  • @weckar
    @weckar 8 หลายเดือนก่อน +3

    Wait. People do that? Make a sound source for every sound? What?
    You have got to be joking right?

    • @renarsgrams
      @renarsgrams 8 หลายเดือนก่อน +1

      Yes, I do. 😄 That's what happens when you learn something new. It was a way I could think of to play five sounds at the same time for one object. But now I will try this way.

  • @wsgamesbr007
    @wsgamesbr007 หลายเดือนก่อน

    FMod the best!!!

  • @Clovenweb
    @Clovenweb 5 หลายเดือนก่อน

    tbh just used first part of video🤣

  • @AliHosseiniDev
    @AliHosseiniDev 8 หลายเดือนก่อน +15

    Meh. just use scriptable objects.

  • @RoxGame
    @RoxGame 8 หลายเดือนก่อน

    can this system play background music while playing another sound effects using one audio source !

    • @SmallHedgeHQ
      @SmallHedgeHQ  8 หลายเดือนก่อน +2

      This SoundManager is optimised for event-based sound effects. Such as playing a sound when criteria are met. For background music, I have a couple of suggestions.
      1. Create a separate audio source and set it to looping. When the music needs to be triggered, call AudioSource.Play() and AudioSource.Stop() when it needs to stop.
      2. Change the play method to SoundManager.Play(Sounds sound, float volume, bool looping). Then if looping is true, create a Coroutine which calls SoundManager.Play() again after the duration of the audio clip. Of course with this way, you’ll need a way to stop the looping, so there’ll need to be a new Stop() method which interrupts the Coroutine.
      I would strongly recommend #1. Unless you are looking to use the SoundManager script to manage all the sound/music in your project. I think the best way is a hybrid approach.