How exactly is Transform.parent saved?

Discussion and help for Easy Save 3
Post Reply
frikic
Posts: 8
Joined: Thu Nov 06, 2014 9:36 am

How exactly is Transform.parent saved?

Post by frikic »

Hi I need a bit of explanation how Transform parent is saved, when I use it in code and read save data it is shown like
"....{"parent":{}...."
and my Transform go to root of the Hierarchy, so I guess its actually not possible to save reference to parent in game
and load it afterwards in new game. And if its like that for what is this used?

Cheers
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: How exactly is Transform.parent saved?

Post by Joel »

Hi there,

The transform parent is usually saved by reference. Please could you tell me more about when and what you are saving?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
frikic
Posts: 8
Joined: Thu Nov 06, 2014 9:36 am

Re: How exactly is Transform.parent saved?

Post by frikic »

***EDITED**** Hm maybe its my mistake with timing of loading, I will recheck that and let you know, thanks for asking "When" that
one ringed a bell..

Ok Ill try to explain what I'm doing.
So I have objects in scene that are child of object that we can call Holder, in scene I have many Holder objects
and objects are being transferred to them, in relation to their current position.
So if player drags object closer to another Holder that one will become parent.
Im wanting to use this so that I can save current local position and reference to a parent.

Im saving position every time object hits ground
ES3.Save<Transform>(name, this.transform);

and load it with LoadInto to objects transform in OnEnable();
if (ES3.KeyExists(name))
ES3.LoadInto<Transform>(name, this.transform);

Please let me know if you need more info
frikic
Posts: 8
Joined: Thu Nov 06, 2014 9:36 am

Re: How exactly is Transform.parent saved?

Post by frikic »

Here an update, so partly i had issue with a loading time (objects were not placed in scene at all), but when I fix it,
I still have issue that parent is always not existing, so object get placed in Hierarchy root level.
All written in previous message is still valid, just Im not calling it OnEnable but wait for some paralax movement to finish
first.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: How exactly is Transform.parent saved?

Post by Joel »

Hi there,

It's not possible to tell what is happening from what you've said. Please could you create a new project which replicates this and PM it to me with instructions?

Also just to clarify, the 'name' that you're using as the when you're saving; could you confirm that this is unique? I.e. there are no two transforms with the same name. Otherwise saving one will overwrite the data for another.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply