Instantiate a button

I tried to instantiate a UI button like this:

			GameObject button = Instantiate(CraftingButton, canvas.transform.position, Quaternion.identity) as GameObject;
			CrafableButtonFieldFiller filler = button.GetComponent<CrafableButtonFieldFiller>();
			CraftingTemplate template = button.GetComponent<CraftingTemplate>();

But what I get is this:

What am I doing wrong? I tried to instantiate it without using a position (Instantiate(CraftingButton)) but the result is the same, how can I fix this?

I don’t know what it’s supposed to look like but I guess it’s due to you not setting its transform properly.

When dealing with UI positions, you are supposed to use this:

So after you instantiate the GameObject, set the positions via code.

Something like:

button.GetComponent<RectTransform>().anchoredPosition = new Vector2(10, 10);