Search Unity

Bug Instantiated Button gets moved to offscreen position

Discussion in 'UGUI & TextMesh Pro' started by Slashstep, Jan 7, 2024.

  1. Slashstep

    Slashstep

    Joined:
    Jan 27, 2020
    Posts:
    2
    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
     

    Attached Files:

  2. Slashstep

    Slashstep

    Joined:
    Jan 27, 2020
    Posts:
    2