Instantiated Button gets moved to offscreen position

Hi,
i have a weird problem:
I made a simple button prefab that gets instantiated through a script at Vector3.zero with a parent transform.
The parent has a vertical layout group attached so that multiple buttons get automatically aligned.
The problem is, that the z value of the rect transform of the buttons is at -3000 + an amount that is depend on the screen resolution. When the resolution gets to big (4k) the buttons move to over -3500 and are not visible anymore. I have no clue, what causes this bug.

Do you have any ideas?
Thanks
Slash



Solved it myself after finding this post: Instantiated UI prefab appearing in an unexpected location

I set the parent of the button in the instantiated function this however keeps the world position of the child object. Instead i had to add in a separat line of code to set the parent:

GameObject go = Instantiate(_spawnButton, Vector3.zero, Quaternion.identity);
go.transform.SetParent(_spawnButtonParent, false);