[FIXED]Adding prefab with script to Canvas

Im trying to add prefab to canvas and it look like this in scene view i have to change LEFT,TOP,RIGHT,BOTTOM to 0 to show the gameObject properly but i dont know how

  GameObject talkBox = (GameObject)Instantiate(box);
            RectTransform boxRect = talkBox.GetComponent<RectTransform>();
            talkBox.transform.parent = canvas.transform;
            boxRect.transform.localScale = new Vector3(1, 1, 1);
            talkBox.GetComponent<RectTransform>().localPosition = new Vector3(0,0,0);

You should use
talkBox.GetComponent<RectTransform>().rect = new Rect(LEFT, TOP, RIGHT, BOTTOM);

What are left, right, top and bottom set to on your prefab? They shouldn’t change.

You may need to use SetParent to get this to work. One of the bool settings prevents the RectTransfom from automatically updating.

left, right, top and bottom are 0 on the prefab but they get changed runTime and i dont know how
I set parent here talkBox.transform.parent = canvas.transform;

I fix it the problem was anchors i set the in the middle and its ok now