Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[solved]Audio no longer plays on my prefab

Discussion in 'Audio & Video' started by agentc0re, Jan 23, 2015.

  1. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    Hello, thank you for taking the time to help me out.

    I am using an asset called "Detonator explosion framework". In my scene, i spawn an asteroid that flies towards the players path. On collision the object calls one of the prefabs from the Detonator Explosion Framework, explodes and makes an explosion sound. It use to do this until i re-imported the asset into my project because i thought i had an older version. Now in my scene the asteroid still explodes and the explosion prefab is seen but no audio is heard. So i decided to see if it was the asset or my scene and created a new test project. In the scene i had it use the same exact scripts as i use in my non-working scene. This time when the asteroid explodes an explosion sound is heard. The explosion prefab was setup in the same way as in my non-working scene.

    Other audio does work, it is only the audio for the explosions that is not working. I hope i don't have to scrap the scene because of this. :/
    Thank you for any help you can provide!
    -Jon

    **EDIT**
    I'd also like to mention that when I place the explosion prefab directly in the scene, hit the play button, the explosion is shown immediately and a sound is played. The same prefab is used when attaching it to objects so they explode on impact.
     
    Last edited: Jan 23, 2015
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'm sure the sound is working. Your Audio Listener component is probably just too far away from the Audio Source for it to be audible based on it min distance / max distance set on the Audio Source. If you change it to a 2D audio clip, it will also be audible.

    If you already have it as 2D sound then I'm not sure what to suggest.
     
  3. agentc0re

    agentc0re

    Joined:
    Feb 28, 2014
    Posts:
    77
    Thank you for replying Jerotas. Changing the audio files from 3D to 2D does indeed solve the problem. I wonder why it worked before without having to make this change? I didn't move my main camera any further/closer.

    Well now on to figure out why the audio level doesn't adjust down the further you are away from the explosion. :D
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    If camera was in the exact same place, something else was different. Either the position of your Audio Source or its 3D settings. There's not really another explanation that one of those :)

    If you use 2D sound the volume will not change at all based on distance, if that's what you're wondering about. That's the benefit of 2D, not having to worry about all that. If you don't want that, then you need to tweak your 3D distance settings.