playMaker

Author Topic: Audio Play action. How to get it to do reset?  (Read 868 times)

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
    • View Profile
Audio Play action. How to get it to do reset?
« on: December 05, 2015, 02:15:33 PM »
So I am using 'audio play' action, I have it play a ding when pressing a button.  It uses the audio source component and outputs to the mixer so I can control the volume better.  It works.  The issue is if a person presses the button again before the audio clip is done playing.  It will be silent because the audio is still on the audio play state.  Once the clip is done, it then goes to the first state wich looks for a button press. 

Is there a way to have the clip play again before it is done?  This can't be a new issue with playmaker. 

I've tried activating the button and deactivating it before and after the menu sound but that looks dumb.  I'd rather just restart the audio clip again on the new keypress.

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
    • View Profile
Re: Audio Play action. How to get it to do reset?
« Reply #1 on: December 05, 2015, 02:17:39 PM »
Here's a quick FSM.

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
    • View Profile
Re: Audio Play action. How to get it to do reset?
« Reply #2 on: December 05, 2015, 05:31:27 PM »
So I figured this on out.  You have to send and event to another game object's FSM.  That way the new FSM will reset to the new state.

1) Set up a button on game object 1.
2) On game object 2, set up another FSM, use playmaker UGUI button on click.  When it's clicked, run the FSM which triggers the menu beep on another game object.
3)  On a third game object, have just the menu beep.  However, it must be a global event.  This was any time the event is triggered it starts at the top interrupting the current menu beep.

looking at the 3 pictures you can see that the menubeep is set up on it's own FSM and state.  It is a global transition (must click the checkmark to make it global).