Page 1 of 1

Multiple same type components

Posted: Mon Jun 01, 2020 8:38 am
by hefaust
Hello,

Is there anyway or workaround to save and load game object with multiple same type components?

Re: Multiple same type components

Posted: Mon Jun 01, 2020 8:58 am
by Joel
Hi there,

In this case you would need to save the Components separately and assign the appropriate data to the appropriate Component using ES3.LoadInto. I.e.

Code: Select all

ES3.Save("components", gameObject.GetComponents<MyScript>());

ES3.LoadInto("components", gameObject.GetComponents<MyScript>());
All the best,
Joel

Re: Multiple same type components

Posted: Mon Jun 01, 2020 9:47 am
by hefaust
Hi Joel,

Thanks for quick response! I think I can come up with a solution using LoadInto. In the attached image you can see a thing I'm trying to save. Two physics objects are connected with Joints, those joints are added by player during playtime, and they do not exist in the prefab. Joint must be on the same game object, because they depends on rigidbody. So I probably should add these joint components to the object before I load into them. This is probably only way to do it?

Untitled - 2.png
Untitled - 2.png (8.49 KiB) Viewed 1419 times

Re: Multiple same type components

Posted: Mon Jun 01, 2020 9:51 am
by Joel
From what I can tell this would be the best way of doing it.

All the best,
Joel

Re: Multiple same type components

Posted: Mon Jun 01, 2020 9:56 am
by hefaust
OK, thank you!