Search Unity

Question Horizontal Layout Group and Dynamically added items

Discussion in 'UGUI & TextMesh Pro' started by scossgrove, Apr 21, 2023.

  1. scossgrove

    scossgrove

    Joined:
    Jan 6, 2016
    Posts:
    35
    Hi,

    I have made a "slot" prefab that is designed at 64 pixels x 64 pixels.
    I've added a horizontal layout group to a game object (container) which scales with the screen size. The horizontal layout group has Child Force Expand selected (width and height).
    Then as the scene is loaded I dynamically add 10 of the "slot" prefabs to the container with a MonoBehaviour.

    My problem is that the slot remain at 64x64 in size and are not scaling with the container.

    What am I doing wrong here?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,492
    This is the 2D forum, not the UI forum.

    I'll move your post for you.