Quantcast
Channel: Questions in topic: "parenting"
Viewing all articles
Browse latest Browse all 302

SetParent with worldpositionstays = false not working?

$
0
0
Hello there. I'm trying to change a ui object's parent using SetParent(). As other answers on the site have suggested, I'm setting the worldPositionStays parameter to false. Using both false and true, the ui object is being centred in the new parent, when I want it to keep its position. The new parent only has an image component - no layout groups or anything. Changing the anchors of the new parent does nothing. Removing the layout group from the original parent does nothing. I have tested it a few different ways and there are no other lines of code moving the objects position. I'm using only RectTransforms, no transforms. Changing the objects position with code after reparenting the object only works if I use a coroutine to delay changing the position (Need to wait for at least 2 frames before it will work). Has anyone had any similar problems or does anyone know what might be wrong? rectTransform.SetParent(currentPage, false);

Viewing all articles
Browse latest Browse all 302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>