Forum rules - please read before posting.

Setting parameter to audio file not working

edited March 2018 in Technical Q&A
Heya,
I've got an actionlist that will play for many of my characters but I want each character to play different soundclips.
So I made 3 parameters that all use the "Unity object" option, made a new actionlist for each character, and set audio clips to those parameters (so 3 different audio clips for each character).

But when I go in game, those clips don't play. However if I remove the parameter and set a clip manually, it works. 

I tried to debug it by making it play dialogue after the 'set parameter' parts and that works, so it is going through. Perhaps it needs a "audio clip" option for the set parameter if the audio files aren't compatible?

Thank you for any help :)

Comments

  • Actionlist that will play what?  I'm not sure what it is you're trying to do here - what Actions are you trying to parameterise, and which fields exactly?
  • edited March 2018
    Hey Chris,
    There's 1 actionlist with dialogue, that includes 3 Sound: Play actions. But I wanted multiple characters to run that actionlist but with different sounds playing for each character.
    So on that 1 actionlist I made 3 parameters (1 for each sound):
    https://imgur.com/a/i4Kea
    Then made an action list for each character that sets those 3 parameters to different audio files on Sound: Play. 
    However when I run it in game, no sounds play at all, but if I take out the parameter and just set the sound manually, it plays. I'm thinking audio files might not be compatible?
  • They should be - it works for me without issue.

    Is a Sound with an ID 35264 present in the scene at the time of playing?  How about if you do the same thing in a scene-based ActionList?

    AC and Unity version numbers too, please.
  • edited March 2018
    Hey Chris,
    I attached a default sound object that was in a random scene for it and it works, but doesn't if I switch scenes as it's not there anymore. So I'm guessing that's why it didn't work earlier, but this actionlist is going to run in every single scene. Do you know a way around this? I can't think of a way to get the same sound object with the same ID in every scene...

    I've already tried making it a prefab in the asset folder and attaching it as the sound object, also tried dragging that prefab into the scene and leaving it the player's child object so it goes everywhere he goes, but it's still silent for some reason...huh.

    EDIT: I also tried copying the working sound prefab in scene and making a new one, but I've discovered the sound only works with the sound object that's in the Game editor's scene default.
  • It'll indeed be down to the Sound only being in the one scene, but this can be worked around.

    ActionList assets refer to scene-based objects via their Constant ID number, which'll be generated automatically by AC and listed underneath object fields.

    If you want the ActionList to run in more than one scene, you must make sure that a Sound object with the same ID is present in each scene, and that this ID matches that listed in the ActionList.  This can be done by making a new Sound prefab just for this, and then checking Retain in prefab? in the asset file before assigning it in the ActionList.

    A couple of tutorials on this:
    https://adventurecreator.org/tutorials/referencing-scene-objects-actionlist-assets
    https://adventurecreator.org/tutorials/referencing-scene-objects-actionlist-assets-2



  • Heya Chris, thanks for that :smile:
    The problem is it only seems to work with sound objects that are the Default in the game editor scene window. So if I change scene, even if I still have that Sound prefab with the same ID, it won't work because it's not the Default.

    Does it do that for you or am I doing something wrong? 
  • The default should only be used if no Sound object is assigned properly - whether through directly assigning it in the field, via ConstantID number, or via parameters.

    Does it work before changing scene?  Please share screenshots that show the various objects / actions.
  • edited March 2018
    Hey Chris
    No it doesn't work before changing the scene, only if I use the default sound it does. It's weird

    https://imgur.com/a/Dllvj

    (dooropen is a placeholder, I'm not weird don't worry)
    The other "Default Sound" is the scene's default sound object

  • edited March 2018
    And what's the ID number of the Default Sound?  If you modified it inadvertently, try re-importing the original prefab again.
  • Hey Chris,
    The Default Sound ID is different because I set the new sound object ID manually
    It's 646580
  • You still haven't mentioned your AC and Unity version numbers.

    I will need to see your scene for myself.  Please upgrade to the latest release if not already, and if it still doesn't work, PM me a .unitypackage file of the scene and asset, along with any related prefabs (the "Default Sound (1)").
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.