Search Unity

Play Sound effect without using audio source

Discussion in 'Audio & Video' started by Kalthramis, Jun 14, 2015.

  1. Kalthramis

    Kalthramis

    Joined:
    Jun 14, 2015
    Posts:
    1
    Hi!

    I'm kind of new to Unity, but it seems in Unity 5 it was changed to where you had to have an audiosource component to play a sound effect, at least as far as I can figure.

    Is there any way to avoid this? Having to attach every sound by both a script and an audio component is going to be a gigantic pain in the ass for me.
     
  2. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    969
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    That works, but you have no control over the audio after it starts playing. You can't stop it, change the volume, etc.

    OP, no Unity 5 didn't change this. It was always that way. You need an Audio Source component to play sound.

    If you don't want to have to do that, you can invest in a plugin that does it for you (and much much more) such as the one in my signature.