Forum rules - please read before posting.

Global Sounds

edited October 2014 in Technical Q&A
I want to have a sound play every time I combine objects in inventory. Is there a way to set a global sound that can be used from all scenes or do I need to create a specific sound object for this sound in each scene?

Comments

  • You'll need to create a "Default sound" prefab per scene.  This is easy to do, though - just click "Auto-create" within the Scene Manager.
  • Thanks for the quick reply. I am playing the sound from within an action list. The sound will play in the scene where I assigned the "Default  sound" to the "engine:play sound" action. But it does not play when I combine the inventory items in other scenes. If I look at the action list in the other scenes the "Sound Object" field has gone empty. 
  • I found a solution to this situation, maybe not the best but it works. I just added "check scene" actions before I did the "play sound" action, and made sure I was using the "default sound" in the current scene. 
  • Oh, I see what you mean - sorry, I was a bit slow on the up-take here.

    Attach a Constant ID script to your Default sound object, and check Retain in prefab? in it's Inspector.  Then, drag it into your Assets folder so that it's now a prefab.  You'll need to use this prefab in each of your scenes: delete the old ones, and use this.

    Now when using your Engine: Play sound Action (and I'm assuming you're using an ActionList asset, here), drag the prefab itself into the Sound object field.  It's ConstantID field will be displayed below.  The Action will then look for a Sound object with the same ID number in the scene, and since each instance of it will have the same ID, it should now work in any scene.
  • This is fantastic, it is exactly what I wanted and so much better than my solution. You continue to impress me with AC.
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.