on iPad retina, dynamically added UI elements to an AutoLayout do not scale right [SOLVED]

hi… i got this huge problem just with iPad retina (on iPhone retina it works perfectly!)

my setup: OSX, Unity 4.6f3, Yosemite latest everything,
Screen Space Overlay Canvas, with scaler at "scale with screensize 1024*786, Match Width or Height, 200 dpi

i’m adding dynamically a prefab of a layout element (a simple image with a text inside) to an Vertical Layout Group container
i’m adding them with a:

var newMedia=(GameObject)Instantiate(MediaPrefab);
newMedia.transform.SetParent(MediaContainer.transform);

on iPad retina, these elements get rendered half size. (see attached screenshot)

i am trying every kind of combination on either the Layout element (flexible width, fixed width, preferred, etc) and container, or scaler…
no way: everythings works perfectly on iPhone… on iPad Retina, NO

i’m also calling MarkLayoutForRebuild() on element and/or container

LayoutRebuilder.MarkLayoutForRebuild(newMedia.GetComponent<RectTransform>());
LayoutRebuilder.MarkLayoutForRebuild(MediaContainer.GetComponent<RectTransform>());

any hint?
desperate

PS: everything else works well, on both retina and nonretina devices… its jsut these DYNAMICALLY added elements that are broken

Set the worldPositionStays argument of SetParent to false.

1 Like

damn Rune, if you’re fast!!

THANK YOU!!

i did really miss forgot that parameter in the SetParent()

ciaooooo