Search Unity

Unity 5 - Audio doesn't play when "Play On Awake" is unticked

Discussion in 'Audio & Video' started by Majestijn, Mar 18, 2017.

  1. Majestijn

    Majestijn

    Joined:
    Jan 24, 2017
    Posts:
    11
    So I have this really weird thing that my audio doesn't play when "Play on awake is unticked" but it does play when it is ticked.

    I have sought for a solution for a long time but couldn't find an answer to my question.

    So basically the setting is a space game. When you get hit by an asteroid the script attatched to the asteroid calls a PlayHitSound() function that plays the sound. But as stated above, the sound only plays when "Play on awake" is ticked, which I don't want.

    Any help would be appreciated!

    Edit: I actually used some breakpoints to see if the code even reached the PlayHitSound() function but it does. It reaches and executes the soundfile.Play() function but somehow when "Play on awake" is unticked it doesn't play the sound
     
  2. lukitone

    lukitone

    Joined:
    Dec 25, 2011
    Posts:
    49
    can you posed your soundfile.Play() function?