SavePosition on RectTransform?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Aephrosi
Posts: 4
Joined: Fri Nov 08, 2024 9:35 pm

SavePosition on RectTransform?

Post 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!
User avatar
Tony Li
Posts: 22034
Joined: Thu Jul 18, 2013 1:27 pm

Re: SavePosition on RectTransform?

Post 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
Post Reply