Welcome,
Guest
. Please
login
or
register
.
June 09, 2026, 04:57:38 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
OnClick and OnHover
« previous
next »
Print
Pages: [
1
]
Author
Topic: OnClick and OnHover (Read 9208 times)
shokinhan
Guest
OnClick and OnHover
«
on:
June 25, 2012, 08:22:45 AM »
The object extends from MonoBehaviour, but when the "OnClick" function was called, the "OnHover" function was called also. why ?
Logged
joreldraw
Guest
Re: OnClick and OnHover
«
Reply #1 on:
June 25, 2012, 08:40:22 AM »
Hover = when mouse is over the button
Press = when down the mouse button
Click = when release up the button (after press)
«
Last Edit: June 25, 2012, 10:12:54 AM by joreldraw
»
Logged
PhilipC
Guest
Re: OnClick and OnHover
«
Reply #2 on:
June 25, 2012, 08:54:05 AM »
Not quite,
OnHover = when the object gets the mouse over
OnClick = When the mouse button when down and up while still over the object
The reason you get a OnHover after a OnClick is to reset the state of the button (puts it back to the hover state). Without sending the OnHover event as well it makes deciding what state the button is in a lot harder.
Logged
shokinhan
Guest
Re: OnClick and OnHover
«
Reply #3 on:
June 25, 2012, 09:00:20 AM »
Your means that when click the button , the function "OnHover" was called is right. I need to remember the state of button, If the current state is hover, that when hover's event callback again, I don't process it.
thanks!
Logged
PhilipC
Guest
Re: OnClick and OnHover
«
Reply #4 on:
June 25, 2012, 09:22:36 AM »
No I would think that you would still process the OnHover. Because when a button gets clicked it goes through a bunch of state changes.
When you go to click a button the states events you get in order are
- OnHover(True)
- OnPress(True)
- OnPress(False)
- OnHover(True)
- OnClick
I'm unsure what you are doing that requires you to store the state (i'm sure there is some reason) but if your storing the current state then you'd switch to the pressed state and you'd need to know that its gone back to the hover state.
Logged
shokinhan
Guest
Re: OnClick and OnHover
«
Reply #5 on:
June 25, 2012, 09:29:06 AM »
when OnHover, i want to show tooltips, and then when Onclick ,If OnHover was called again, and then the tooltips will show again. I don't want the tooltips show again. So I adgust
that if OnHover was called second, I dont' show tooltips.
Logged
PhilipC
Guest
Re: OnClick and OnHover
«
Reply #6 on:
June 25, 2012, 09:37:14 AM »
Your not using the OnToolTip(show)?
"- OnTooltip (show) is sent when the mouse hovers over a collider for some time without moving." (from UICamera note at the top of the file)
When you click the tooltip is dissapear and not reappear.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
OnClick and OnHover