how to make instantiated gameobject to have rectTransform of the canvas/parent?

public GameObject canvas;  // the canvas
public Gameobject changerPopup;  // UI prefab

GameObject changerSign = Instantiate(changerPopup, new Vector3(235, 350, 0), this.transform.rotation);
changerSign.transform.SetParent(canvas.transform);

this will make a UI at the screen. while it does make the object as wanted, the rect transform won’t get fixed(?) to the newly set parent(the Canvas), but instead to where it was first made. how could I get it under canvas’s rect transform? could be some too basic question, but couldn’t find any answer anywhere so far :frowning:

I tried that, also tried

GameObject changerSign = Instantiate(changerPopup, new Vector3(235, 350, 0), this.transform.rotation, canvas.transform);

but still don’t gets under canvas rect transform.

struggling with this for 8 hours with no luck… anyone know how to solve this mess, well I’ll really be grateful :frowning:

using unity 5.5.1

Is this what you’re looking for?
public static Object Instantiate(Object original, Transform parent, bool instantiateInWorldSpace);

GameObject changerSign = Instantiate(changerPopup, canvas.transform, false);

This will spawn the prefab and instantly make it a child of the canvas, while not keeping the worldspace position.

You will also have to set the anchors manually if you want it to appear how you actually want it.

yeah a bit late reply, turned out I needed to use localposition.

ugh it was horrible to know this after all the struggles. thank you everyone for checking out to help anyway.