Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Sound gets cut off.

Discussion in 'Audio & Video' started by Avestas, Apr 14, 2015.

  1. Avestas


    Jun 8, 2013

    I am experiencing a strange and annoying problem with my audio playback.

    What I am trying to do is quite simple, certain actions (e.g. shooting, getting hit etc.) should have sound effects:

    I am doing this via:

    Code (JavaScript):
    1. var BasicShootSound:AudioClip;
    2. var shootVolume:float;
    4. if(shoot){
    5.        //do stuff
    6.         AudioSource.PlayClipAtPoint(BasicShootSound, transform.position, shootVolume);
    7.        //do stuff
    9.     }
    While this is working, strange things happen, when (relatively?) many sound clips are played shortly after another.
    For example: The player shoots every 0.5s, therefore might hit something every 0.5s, and maybe some other sounds are played. (but these sound clip are not very long, at max 3 seconds, the last 2 seconds is merely a fade)

    What happens is that the sound clips are not played completely, they sometimes seem to be cut up early, and the volume of the effects seem to change when other sound effects trigger.

    The audio format of the imported files is .wav, and is set to load into memory.

    Btw my game is targeted for mobile devices.

    Thanks in advance! :)