Page 1 of 1

SavePosition on RectTransform?

Posted: Sun Nov 10, 2024 12:39 am
by Aephrosi
I've built an inventory system where items(images) can be freely dragged and dropped anywhere within a panel.

I've attached a PositionSaver, and it sooooort of works. It's spawns the object but it's not a child of the panel. This is fine, I can set the parent in the Awake() function, but the position values are still way off. Just curious if there's already a solution for this that I am missing.

Thanks!

Re: SavePosition on RectTransform?

Posted: Sun Nov 10, 2024 9:52 am
by Tony Li
Hi,

PositionSaver saves the the world position of non-UI objects. You can write a custom saver to save the RectTransform's anchoredPosition value. Please see: How To: Write Custom Savers