Author Topic: OnRelease not working  (Read 3173 times)

Zodd

  • Guest
OnRelease not working
« on: September 21, 2013, 12:37:37 AM »
I'm having some issues getting the OnRelease function to work. For the sake of troubleshooting, I just have it printing a message when OnRelease is entered. I have an OnPress function in the same script and it is working just fine. Perhaps I am misunderstanding how OnRelease works or something? Does it not trigger when a held down click is released? My buttons are using a modified draggable object script, that is basically the normal draggable object script, except the target is set to gameObject, and thus the buttons drag themselves. Just thought I should include that in case it makes any difference :/

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: OnRelease not working
« Reply #1 on: September 21, 2013, 05:32:45 AM »
What OnRelease? There is only OnPress with a boolean parameter -- 'true' for press, 'false' for release.

Zodd

  • Guest
Re: OnRelease not working
« Reply #2 on: September 21, 2013, 02:28:47 PM »
Well that explains things. I was confused perhaps by this: http://www.tasharen.com/ngui/docs/class_u_i_button_message.html

But maybe that's something different.... it just had all of the names of the other functions that I was using, and thus I assumed OnRelease was also a function.

So how would I go about triggering events upon the release of the draggable button? I found a more relevant page: http://www.tasharen.com/?page_id=160
And I would think that OnClick should work, since no matter what the collider should remain under the mouse while dragging, and it should trigger upon the release of the button, but it doesn't... It works if I don't move the button at all, but not if I move it. I also tried OnDrop, because I would think that if OnClick isn't working, that OnDrop would, considering that in the event one of them was not triggered, the other would have to be, but it didn't work either :/ Do I need extra scripts other than the default ones attached by the widget wizard when creating a button?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: OnRelease not working
« Reply #3 on: September 21, 2013, 07:23:26 PM »
Still OnPress(false). Check the drag & drop example.

Zodd

  • Guest
Re: OnRelease not working
« Reply #4 on: September 22, 2013, 04:28:21 PM »
I see, I was unaware that OnPress could receive a boolean and that I could just use that to determine the objects behavior. Works now! Thanks!