Hello,
I use click 2 move script, my problem is when i click to an button character moves, how i can lock movement when im over of GUI?
(for now i use a newbish way like)
public static bool lockMovement = false;
void OnMouseEnter()
{
lockMovement = true;
}
void OnMouseExit()
{
lockMovement = false;
}
if (ActionBarManager.blockMovement)
return;
// And i use it like this in click to move sript
if (Input.GetMouseButtonDown(0))
{
if (isCollided)
{
transform.position = Vector3.MoveTowards(transform.position, Vector3.back, Time.deltaTime * Speed);
isCollided = false;
}
// Get Clicked Position in 3D World
Ray ray = myCamera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, MaxClickDist))
{
// This will allow take target without any prob
if (hit.transform.tag != "Ground")
return;
if (ActionBarManager.blockMovement)
return;
TPoint = hit.point;
}
}