Forum rules - please read before posting.

Sound as a prefab unresponsive when called from Sound: Play

edited November 2022 in Technical Q&A

Trying to play a Sound asset that's retained as a prefab. Using OnStart with Sound: Play as normal. The scene does start but the sound won't play, only if the Sound is present in the scene as a gameobject. What's the solution?

I'm not using the AC Music System in this case because I need direct access to the Unity audio filters for this sound file.


Comments

  • The scene does start but the sound won't play, only if the Sound is present in the scene as a gameobject.

    An AudioSource must be present in the scene in order for it to play - this is Unity's built-in behaviour. You can either drop an instance of the prefab into the scene file itself, or use the Object: Add or remove Action to spawn it in at runtime.

    Alternatively, you may still be able to rely on AC's Music system, provided you rely on Audio Mixer Groups for audio playback. This causes AC Music to be played via a Mixer, to which you can apply filters such as reverb, etc.

    If you only want such filters to be applied during a certain scene/track, you can create them as a snapshot and use AC's Sound: Set mixer snapshot Action to control it.

  • edited November 2022

    Thanks. Dropping a Sound instance into scene or Object: Add still won't let me manipulate the audio filter components on the audio source with something like Object: Call event from a different ActionList asset.

    (I know this is a hacky solution but I just had to try.)

    I did use Audio Mixer Groups in a previous project, I know they're the best solution this side of FMOD, but I also felt that they overcomplicated the audio side of my project.
    AC's music/ambience system is the perfect alternative for me, except this aspect of not supporting filters out of the box.

  • I shall add the ability to override the auto-generated Music/Ambience sound objects with custom prefabs in the next release.

  • That would be a great addition, many thanks!

  • I shall add the ability to override the auto-generated Music/Ambience sound objects with custom prefabs in the next release.

    Thank you for this, I see it's already added.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.