I always seem to have issues with buttons
ok..
So, I always do my buttons in the same way
when touch is inside
--do whatever cool effect I have made to show a touch is made
When touch is released
--after 0.3(or so) seconds
----do whatever the button is for
And this works......for the most part.
Every now and then, the button just won't do the thing it's there for (change scene, change camera origin, load game centre....or whatever)
This happens when viewing on the mac as well as on the device. and maybe only happens say, 1 in 20 times....but even 1 in 20 is unacceptable.
The touch effect works 100% of the time, even if the release action fails I should point out.
So it must be something to do with my release rules???
I have tried run to completion on, or off, on the final timer, that seems to make no difference.
Anyone else noticed anything similar?
So, I always do my buttons in the same way
when touch is inside
--do whatever cool effect I have made to show a touch is made
When touch is released
--after 0.3(or so) seconds
----do whatever the button is for
And this works......for the most part.
Every now and then, the button just won't do the thing it's there for (change scene, change camera origin, load game centre....or whatever)
This happens when viewing on the mac as well as on the device. and maybe only happens say, 1 in 20 times....but even 1 in 20 is unacceptable.
The touch effect works 100% of the time, even if the release action fails I should point out.
So it must be something to do with my release rules???
I have tried run to completion on, or off, on the final timer, that seems to make no difference.
Anyone else noticed anything similar?
Comments
this works.. but every now and again, the release stuff doesn't happen (i.e. it doesn't change the scene)
Although if it were me I would put all of that in a touch is pressed rule. Its seems like a way over kill to use two rules for a change scene button.
Also. it may be overkill, but it makes the front end far more polished and inline with what most good front ends do.
e.g. imagine i click the button, but then realise I didn't want to press it. if I then move my finger without lifting off, the "touch release" trigger doesn't happen, and hence the button is not triggered. 99% of good front ends do this if you have noticed.
If I had the change scene rule on the touch is pressed, it would always change the scene even if I have changed my mind.
It may not trigger a release if you touch elsewhere, slide over the icon, and then release.
Then if mouse is up, check if is_pressed is true, and then execute your button released portion.
You'll want to add to the Otherwise
When Mousebutton is down
and Mouse position is outside
--Change is_pressed to false
That way if you slide off it will go false.
But the boolean being set to true when you will release will help ensure that the entire change rule runs.