So, I am trying to make a simple GUI Instantiate system. The GUI is going to spawn successfully, but the position is wrong.
Position : (Left, Right: 249.8423 ; Top, Bottom : 400)
Anchors : (Min: X:0 Y:0 ; Max: X:1 Y:1)
Pivots : (X:0.5 Y:0.5)
Rotation : (X:0 Y:0 Z:0)
Scale : (X:1 Y:1 Z:1) always...
My Code :
GUIPausePopup pause = UI.Create<GUIPausePopup>(GameObject.Find("Canvas"));
//Spawn and set parent(Canvas)
pause.GetComponent<Transform>().gameObject.SetActive(true);
//Working without any issues.
//Position system not work. I don't know why.
pause.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0f, 0f, 0f);
pause.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 0f);
pause.GetComponent<RectTransform>().localPosition = new Vector3(0f, 0f, 0f);
pause.GetComponent<RectTransform>().position = new Vector3(0f, 0f, 0f);
pause.transform.position = new Vector3(0f, 0f, 0f);
pause.transform.localPosition = new Vector3(0f, 0f, 0f);
Thanks for help...