Character movement with click

I’m a completely beginner at game developing.
I’ve browse through tutorials on internet about 2d game with unity, but mostly its about platformer or something similar (movements are right-left-jump, means not the one i’m looking for).
What i wanna make is ‘diner dash’ like game, when player click on a table(or anything) the player is move toward the object, and do something (in diner dash case, she take customer’s order). and most of the tutorial that i’ve watched the controller is using keyboard. So, any suggestion where i have to start? Any keyword for google search?
sorry for my engrish :frowning:

To translate mouse position to world-coordinates you would want to use a Raycast.
So that’s how you will know where the player clicks. The code would look like this (you can also check out this video):

float speed = 10f;
float rotationSpeed = 20f;

void Update () {
         if (Input.GetMouseButton(0))
                {
                    RaycastHit hit;
                    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                    if (Physics.Raycast(ray, out hit)
                    {
                        Vector3 newPos = Vector3.MoveTowards(transform.position, hit.point, Time.deltaTime * speed);
                            Vector3 _direction = (hit.point - transform.position).normalized;
                            Quaternion lookDirection = Quaternion.LookRotation(_direction);
                            lookDirection.x = 0;
                            lookDirection.z = 0;
                            gameObject.transform.rotation = Quaternion.Slerp(transform.rotation, lookDirection, Time.deltaTime * rotationSpeed);
                            transform.position = newPos;
                           }
                 }
    }

In the above code we first check if the player is pressing the left mouse button.
Then we create a ray using the mouse position (ScreenPointToRay translated the screen point to a world point and direction).
If use the ray in a Raycast, which will return a RaycastHit (hit) if it hits something.
We then create a new position, that will be somewhere between transform.position and the place we hit with a max distance of Time.deltaTime * speed (you will have to set the speed as a float yourself).
Then we use some quaternions and normalized vectors to get a direction to look at. This is not needed for the movement, but it looks nice when you character turns.

And finally we set our transform.position to the new position, and since this is in the Update()-function it will run every frame and you will move closer and closer to the goal.

And for a move on click function you would loop this code after the player releases the button. It would look like this:

void Update(){
 if (Input.GetMouseButtonUp(0))
            {
                    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                    RaycastHit hit;
                    if (Physics.Raycast(ray, out hit))
                    {
                            StartCoroutine(MoveToPoint(hit.point));
                      }
              }
}

float speed = 10f;
float rotationSpeed = 20f;
IEnumerator MoveToPoint(Vector3 newPos)
    {
        Vector3 _direction = (newPos - transform.position).normalized;
        Quaternion lookDirection = Quaternion.LookRotation(_direction);
        lookDirection.x = 0;
        lookDirection.z = 0;
        while (Vector3.SqrMagnitude(transform.position - newPos) > 0.5f)
        {
            Vector3 nextPos = Vector3.MoveTowards(transform.position, newPos, Time.deltaTime * speed);
            gameObject.transform.rotation = Quaternion.Slerp(transform.rotation, lookDirection, Time.deltaTime * rotationSpeed);
            transform.position = nextPos;
            yield return new WaitFixedUpdate();
        }
    }

Where you again will have to set the float speed and float rotationSpeed youself.