transform.position, wierd "bug"

I made this function that I use to pop up some buttons over and object when the player clicks on it.

    public virtual void popUp(Vector3 position)
    {
        setActive(true); //Set the canvas that contains the menu to "active"
        Vector2 pos = Camera.main.WorldToScreenPoint(position);
        Debug.Log(pos);
        menu.transform.position = pos;
        Debug.Log(menu.transform.position);
    }

It is quite simple and works fine… Except for the very first call. When it is first called, the transform’s position remains (0,0,0) event when the pos variable printed the correct position the line before.
Anyone knows what can prevent the transform to update its position ?

is “menu” a UI- Element?

it really just a guess, but maybe it has to do that these UI-Element work with RectTransform instead of Transform

GetComponent().position

Menu is indeed a UI-Element.
I tried using Rectransform.anchoredPosition instead of transform.position but I had a constant offset and never figured out why, that’s why I ended up using this solution which isn’t the best.

Still I find it wierd that the very first call fail and not the other, if using RectTransform.anchoredPosition solves the problem (and I’ll give it another try), then I’d really like to understand why and how…