Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Grid slots don't resize correctly when populating a grid from script

Discussion in 'UGUI & TextMesh Pro' started by Melang, Aug 26, 2014.

  1. Melang


    Mar 30, 2014
    When I try to populate a grid by instantiating the slots and parenting them to the grid, if I run the game at a resolution that is different from the "Referenced resolution", the slots are not resized correctly. I've tried both transform.parent = ... and transform.SetParent().

    On the screenshot the 1st slot was there already before the game started and its size is correct, the others were instantiated.

    What's funny is that the other slots show in the Inspector (in grayed out font) that they are the same width/height as the first one!

    Note that if I manually drag the prefab and parent it while in game or duplicate it with ctrl-D, it is resized just fine. I can submit a bug, but how to fix this without waiting for the next build? Maybe there's a way to mimic what happens when I ctrl-D the slot from within the grid?

    Attached Files:

  2. Tim-C


    Unity Technologies

    Feb 6, 2010
    Please submit a bug, not sure of what it is until I see the project.