Hello Guest

Author Topic: OnClick event  (Read 3687 times)

Vartib

  • Newbie
  • *
  • Posts: 21
    • View Profile
OnClick event
« on: December 07, 2013, 09:33:03 pm »
I have a button that when clicked should activate another game object using the OnClick event. Along with this, I have another event system that keeps track of left clicks (the mouse being released from the down position) for the rest of the game. When the button is activated this second event system is set to disable the button. This means that there are two different event systems keeping track of left mouse button clicks. The problem this creates is that the button is deactivated before it has a chance to run its own event to enable the other game object. Essentially the button is disabling itself while enabling another game object.

What would be the best way to ensure that the other game object is enabled before the button gets disabled?
« Last Edit: December 08, 2013, 12:52:08 am by Vartib »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: OnClick event
« Reply #1 on: December 08, 2013, 11:12:16 pm »
It sounds counterintuitive to have 2 separate event systems for this, wouldn't it be possible to consolidate this? Or, make the other system run after this? Or modify the ui manager click management to work better with your other system.

Vartib

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: OnClick event
« Reply #2 on: December 09, 2013, 06:36:44 pm »
I'm using the Tk 2d UIItem script for the OnClick event, which seems to be more geared toward telling whether or not a button was clicked rather than just if the mouse was clicked (not taking into consideration what was clicked). I didn't know it was possible to set the script order, but I tried it and it fixed my problem. Thanks again for your help :D