- Home /
Question by
Gilles_aerts · Jun 15, 2015 at 06:00 PM ·
uirecttransform
Settings a rect transform to zero
Hi
I have a button that instantiates a textfield as a child of a panel in my canvas. But if I Instantiate it the anchor points are in the correct place, but the rect transform is completely off the road.. if I zero out all the rect transform properties while in play mode , the textfield looks just the way I want it.
Does anyone know how I can zero out the properties of a rect transform in code ?
this is what my Function looks like of the button :
public void TestButton(){
GameObject go = Instantiate(prefabToInstantiate) as GameObject;
go.transform.SetParent(panelParent.transform);
}
Thank you
Comment