References between two GameObjects

Discussion and help for Easy Save 3
Post Reply
vikramapilla
Posts: 8
Joined: Thu Mar 03, 2022 8:16 pm

References between two GameObjects

Post by vikramapilla »

Hi Joel,

I have a custom class ReferenceHolder that contains a field called copyObject. In this copyObject field I store reference of a gameObject. For example, I have two gameObjects A and B, with A having a copyObject reference to B and vice-versa.

These gameObjects are deleted during runtime. With ES3, I can save the deleted gameObjects without any problem. However, when I load the deleted gameObjects back, the reference in copyObject field is only restored for one of the gameObjects and not both. Could you please help me with how I could restore the references between both the gameObjects?

Best,
Vik
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: References between two GameObjects

Post by Joel »

Hi there,

This is because one of the GameObjects will not exist when you load the other. In this case you would need to load twice, or save the Components in question separately and load them afterwards.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
vikramapilla
Posts: 8
Joined: Thu Mar 03, 2022 8:16 pm

Re: References between two GameObjects

Post by vikramapilla »

Thanks for your quick answer. I can confirm that it works like a charm! :)
Post Reply