Author Topic: UIPlaySound plays with trigger=OnMouseOver when button is clicked  (Read 2950 times)

Nicky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
I have UIPlaySound configured to play different audio for OnMouseOver and OnClick.

Both are played when I click on the button, which should not happen as to the user, the mouse did not go away from the button.

Is there any specific setting or code that is required to ensure only the OnClick audio plays when I click the button?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPlaySound plays with trigger=OnMouseOver when button is clicked
« Reply #1 on: January 15, 2014, 09:48:55 PM »
NGUI sends a "mouse over" event after click assuming the mouse is still over the button, which is what triggers your sound. I would advise you to create a simple custom script instead of using two UIPlaySound scripts. Include both audio clip references and trigger only one of them as needed.

Nicky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: UIPlaySound plays with trigger=OnMouseOver when button is clicked
« Reply #2 on: January 16, 2014, 12:42:36 AM »
Thanks! Have done my own class for that already. Just curious why the default behavior of UIPlaySound re-triggers the onmouseover audio when technically the mouse did not leave the button.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPlaySound plays with trigger=OnMouseOver when button is clicked
« Reply #3 on: January 17, 2014, 12:18:05 AM »
Just an old issue that never got fixed because no one brought it up. I'll have it fixed in the next release.