HOW TO PLAY SOUND EFFECTS WITH A TRIGGER IN C# UNITY TUTORIAL

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

КОМЕНТАРІ • 97

  • @DollyPopCorp
    @DollyPopCorp Рік тому +2

    Thank you so much for this! I've been struggling for days as an absolute newbie and this was so straightforward and FINALLY helped me to trigger sound! Wish I could like this video 100x

  • @akshayjose6555
    @akshayjose6555 4 роки тому +8

    Thank you...
    I've been looking this for months. You're a hero.

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

      Time consuming is important. If you look for this method for months, how much time would it likely to take your time to make one game , 5 years ? or whole life?
      P.S: Find It in 2 minutes.

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

      @@i_am_reshad hmmm wtf

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

      @@stingandr back for you

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

    This is perfect! Just what I was looking for. Was doing it wrong at first, and realized I had typed something wrong, but works perfectly when you do it right!

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

    this is the first ever c# code I have ever written and its because of you will be checking out some of ur vids if I need help

  • @ghostlyvampire
    @ghostlyvampire 4 роки тому +5

    Insanely simple and great, thank you for the upload!

  • @johnculhane438
    @johnculhane438 5 років тому

    Thanks. This was as clear as a bell. Some of the other vids out there are either olde or over complicated.

  • @oakleyblade9400
    @oakleyblade9400 4 роки тому +1

    2:58 That sound that I was setting up was a jumpscare sound. gee thanks

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

    Hey man, thanks so much for this, I've been looking around the internet for this kind of tutorial, this one's a life saver, thank you so much

  • @JonJonGames
    @JonJonGames 5 років тому +4

    You seem to be having fun with Unity 2019.1.

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

    thank you so much for this!! amazing tutorial

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

    Thank you!!!
    I've been looking this for my music production project for video games but I didn't understand anything about it, you saved me the semestre, thanks!
    Saludos!

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

    hi there. i have ZERO knowledge on coding and i just wanted a quick tutorial on triggering simple sounds in unity. however, when i am writing these exact lines in my visual studio, apart from "void" and "public", all other text i write is just a plain black letters. no keywords/tags jumping on me like in your video. after i write "OnTriggerEnter" - it just stays like that and no "collider other" ever shows up. so... erm. what do i do?

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

    Thankyou , helped me alot!

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

    Best tutorial but i do have one question, wouldnt the collider cause you to bump into it?

  • @QLTD
    @QLTD 5 років тому +3

    I like these mini tutorials, thanks Jimmy

  • @hastriv
    @hastriv 4 роки тому

    Much better than audiomanager. Thx!

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

    It worked, you are amazing!! Thank you so much

  • @user-nJ2up5mo4t
    @user-nJ2up5mo4t 2 роки тому

    thanks bro since they did not made Bolt futural on this i used your video fast and easy

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

    Thanks for the great tutorial!

  • @AetherXIV
    @AetherXIV 4 роки тому

    wow that actually worked. I like simple solutions

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

    Hi ! In visual studio why isn't suggesting me the references as yours? the only one that works is public; the next ones such as audio source doesn't come up. Thank you for your help

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

    Great tutorial

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

    Big help thank you!!!

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

    Thank you SO MUCH for this!

  • @sufianahmad7337
    @sufianahmad7337 4 роки тому

    Easy and quick way Thank you

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

    Assets\FPS\Audio\SFX\TriggerSFX.cs(8,12): error CS0246: The type or namespace name 'Audiosource' could not be found (are you missing a using directive or an assembly reference?)
    How would I fix this?

    • @Saukr
      @Saukr 4 роки тому

      also problem

    • @iAmazingGraphics
      @iAmazingGraphics 4 роки тому +1

      just change from ''Audiosource'' to ''AudioSource'' and it should work fine.

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

    Thank you !
    How to make the sound work only one time ?

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

      put in a line to disable the collider. loads of my tutorials cover disabling components in code

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

    Very helpful, thank you :)

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

    It worked. Thanks

  • @MetaverseAdventures
    @MetaverseAdventures 4 роки тому

    Thank you for this. It really helped me. Subbed.

  • @Mustafa-sv3zz
    @Mustafa-sv3zz 3 роки тому

    Great tutorial :)

  • @SYB-VidArt
    @SYB-VidArt 3 роки тому

    hi amazing solution , thankyou. just it doesnt play in my build , wondering if you know why ?

  • @nirmalashome
    @nirmalashome 4 роки тому

    Hi there, I followed all the steps in the video but no sound is playing when I move my player onto my trigger sound object. Wondering if there is anything I need to add to my player script, or should be adding something like CompareTag("player") into the OnTriggerEnter in my trigger script? The 2nd question I had was why you added the sounds to the player rather then on the tigger objects themselves? Thanks for your tutorial.

  • @CamperJohn
    @CamperJohn 5 років тому

    Nice and simple...thanks for sharing.

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

    If I were setting this up with an arcamera as the player does the camera need a rigidbody?

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

    Thanks it literally only took me 3 minutes

  • @Stinger-rq4gy
    @Stinger-rq4gy 3 роки тому

    Excellent thank you for making these videos🌈🥇🏆🚀👍

  • @tincoES
    @tincoES 4 роки тому

    thanks! helps a lot

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

    the option to select a sound in the script when you put it on the cube, it doesnt show up

  • @learnMax
    @learnMax 5 років тому +1

    Why put the sounds on the player object rather than on the trigger objects? Seems like you'd get the potential for spatializing it if you place them on the triggers themselves.

    • @JonJonGames
      @JonJonGames 5 років тому

      Eric Ameres the player Object is more reasonable.

    • @learnMax
      @learnMax 5 років тому +1

      @@JonJonGames why do you say that? What if there were dozens of triggerable sounds effects?

    • @JonJonGames
      @JonJonGames 5 років тому +1

      Eric Ameres player object = Simple ;)

    • @learnMax
      @learnMax 5 років тому +1

      @@JonJonGames I dunno, one sound per trigger object seems pretty simple to me, plus you get more functionality. It's more modular, etc. You can more easily use prefabs if you need multiples, etc. I was wondering if Jimmy had some performance reason or something. I think his tutorials are great, but just wondering about the reasoning on this one. Maybe he'll reconsider...

    • @SteveTheExploiter
      @SteveTheExploiter 5 років тому +1

      I agree. ANY of my sound effects emit from the object/trigger. i am not loading up my character with 1500 sound files (my character doesn't care about birds, frogs, or insects when it enters a swamp). I'd rather the object that makes the sound be responsible for the sound. As far as spatializing, technically, if your character triggered the sound, it would emanate from your character.

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

    A great tutorial!
    One quick question tho, how can I make the trigger only go off once?

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

      turn off the collider in the code when it triggers

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

      @@JimmyVegasUnity how do you do that?

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

    Sank you, Jimmy. 3:00 is my mistake too #facepalm

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

    Thank u some much 😯

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

    Thank you

  • @orlacasey2283
    @orlacasey2283 5 років тому +1

    Hello hello, I followed you tutorial and it doesn't seem to work for me. Initially when the sound was 'play on awake' it works, when I uncheck that to have it as a trigger, I don't hear the sound effect when I run to the box. What am I missing? I really appreciate the tutorial!!!

    • @JimmyVegasUnity
      @JimmyVegasUnity  5 років тому +1

      PlayOnAwake means it will play when the game starts. So it isn't the trigger setting it off. Have you ticked IsTrigger on the Collider Component?

    • @kdgroup9674
      @kdgroup9674 5 років тому +1

      @@JimmyVegasUnity It's Orla here. I didn't click is trigger, works perfectly now. Thank you so very very much!

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

    Thanks!

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

    hi, I have a question I want to destroy the element and add a sound ( like guitar pro) but, when the element is destroyed the reference of the audio source is lost, how do I fix this?
    i have 7 cubes with different notes, so i want that the trigger destroy the object and play a note for each of them.

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

      Best thing to do is to set the audio element on a separate object. So for example, add an empty game object, name is "Audio" and then add 7 child objects with the sound on each

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

    Thanks for the video, really helpful! I am using Wwise to implement my audio so you may not know exactly how to translate this in script, but I'm looking to create a script to attach to destructible objects to trigger a SFX for when the object is destroyed. Would you know how to do this? I'm new to scripting so am just learning the (very complicated) ropes! XD thanks so much in advance

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

      try adding a sound before the object is destructed

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

    Very good

  • @thegambler975
    @thegambler975 4 роки тому +1

    I had issues with triggering it

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

    how do i make it so it can only play once

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

    Is there a way to make it so you click it to trigger it instead of walking through it ?

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

    Nice tutorial, how can i make it sound just one time?

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

      this.gameObject.SetActive(false);
      place this after you play the sound

    • @MuhammadAmin-bb9uh
      @MuhammadAmin-bb9uh 3 роки тому

      @@JimmyVegasUnity You're the best Jimmy!🖤

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

    very good viedo

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

    What if I want to trigger it by clicking on an object? pls help

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

    I turned off play on awake but it kept playing anyway

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

    but could you do a tutorial that if I click E, then the sound will start playing?

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

      Search up input commands on youtube and then add the sound player to it.

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

    when im in visual studio, the audio code wont appear

  • @FrostyDevelopment
    @FrostyDevelopment 5 місяців тому

    Bro you can't just 'drag and drop' sound1 into the player 2:53 ._.

    • @FrostyDevelopment
      @FrostyDevelopment 5 місяців тому

      Nevermind sorry you can :( GREAT TUTORIAL THO KEEP IT UP!!!11!1 the only thing i would ask is how to get the sound only to play once?

    • @JimmyVegasUnity
      @JimmyVegasUnity  5 місяців тому

      what are you talking about?

  • @carlanicolella339
    @carlanicolella339 4 роки тому

    thank u!!!!!!!!!!!!!!

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

    Sadly, it doesn't work, I can go trough the trigger and nothing happens

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

    THX SO MUCH

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

    Thanks!!!

  • @FrostyDevelopment
    @FrostyDevelopment 5 місяців тому

    how do you make it play only once

    • @JimmyVegasUnity
      @JimmyVegasUnity  5 місяців тому

      turn the box collider off after you enter it… so it’d be GetComponent().enabled = false;