Scale weird behavior

Hey everyone,

recently started to learn about how scale behaves as I want to make my app available in multiple resolutions.
Here is the setup:

  • App is 2D UI
  • Canvas is set to Constant Pixel Size
  • Canvas includes 3 main GameObject panels that are populated based on what menu option the player selects
  • When menu option is selected the three main tabs get garbage collected from children and they are populated with the new content

When the resolution changes the three main panes get repositioned and rescaled by the old/new width and height ratio screen difference. everything looks good! But when menu option is clicked and content gets rebuild all pane content is created with the opposite scale number. For example:

changing resolution from 1200x800 to 1440x960 gives ratio 1.2 for width and height.
Panes ratio get rescaled and repositioned by 1.2 and everhing looks exactly the same on both resolutions.

When the same menu option is selected and content is rebuild, all content in the panes get rebuild with scale 0.8333333 even though main panes scale is still 1.2.

Why is this happening? Where does this behavior originates?

How do you populate your tabs with items? Do you instantiate items and then call SetParent()? If so then make sure to pass false as a second argument. Just my guess, but I mess with it periodically.

Thank you I will try that! I lurked quite a lot on the net and found that there are many issues with scaling.
Another solution i found is to unbind and bind children to the parent after rescale.

Thanks!