How can I move a Gameobject to Button position?

I am creating a board game and the character (the gameobject) has to move to the position of the pressed button.

    public void TaskOnClick(Button btnpro)
        int currentId;
        int id = System.Int32.Parse(, 12));
        if (currentButton == null)
            currentId = 0;
        } else
            currentId = System.Int32.Parse(, 12));
        if (currentId + 1 == id || currentId - 1 == id || currentId + 8 == id || currentId - 8 ==id)
            Debug.Log("This should work");
            Plane plane = new Plane(Vector3.up, transform.position);
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            float point = 0f;
            if (plane.Raycast(ray, out point))
                targetPosition = ray.GetPoint(point);
            isMoving = true;
            currentButton = btnpro;

This function is called when the player clicks the UI Button. Debug.Log() function runs so all the code here should work
And there is another function named MovePlayer() which is called in the Update() void. Here is the code of MovePlayer()

   public void MovePlayer()
        this.transform.position = Vector3.MoveTowards(this.transform.position, targetPosition, speed * Time.deltaTime);
        if (this.transform.position == targetPosition)
            isMoving = false;

The problem is that the character doesnt move.
All the ui buttons call the function TaskOnClick here

I tried a lot of things and I didnt manage you make it work. If you know a better way to do what i want or you know what’s failing, let me know :wink:

Bump! May anybody answer?

I need to move the button via script and without any workaround (layout usage, text, color change) too. Did you found a solution?