Hello
Guest
Home
Help
Search
Login
Register
2D Toolkit Forum
»
2D Toolkit
»
Support
»
OnClick event
« previous
next »
Print
Pages: [
1
]
Author
Topic: OnClick event (Read 2865 times)
Vartib
Newbie
Posts: 21
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
»
Logged
unikronsoftware
Administrator
Hero Member
Posts: 9709
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.
Logged
Vartib
Newbie
Posts: 21
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
Logged
Print
Pages: [
1
]
« previous
next »
2D Toolkit Forum
»
2D Toolkit
»
Support
»
OnClick event