I have a simple script.To tween a Button Position and width onHover. The problem that am facing is the script works fine when the mouse is hover on the button but when it is clicked the onHover method is triggered twice. Below is the code that i am ususing. I wanted to know is there any way to detect mouse click.
Original Code without mouse click Detction
public TweenPosition tweenPosition;
public TweenWidth tweenWidth;
void OnHover(bool isOver){
if(isOver){
tweenPosition.enable=true;
tweenWidth.enable=true;
Debug.Log("Event Hover");
}else{
tweenPosition.enable=true;
tweenWidth.enable=true;
Debug.Log("Event Hover Over");
}
}
I want to achieve something like this code below but does not know how can i detect the click event
void OnHover(bool isOver){
if(isOver && !clicked){
Debug.Log("Event Hover without click");
}else if(isOver && clicked){
Debug.Log("Event Hover with click");
}else{
Debug.Log("Event Hover Over");
}
}