BoxCollider2D not loading

Discussion and help for Easy Save 3
Post Reply
Ptolemie
Posts: 7
Joined: Mon Apr 24, 2023 8:45 pm

BoxCollider2D not loading

Post by Ptolemie »

Hi there, I’m testing the implementation of EasySave3 in my project and have run into an issue. I’ve added an ES3 manager to my scene, and enabled ES3 for prefabs, as well as defined each custom type I have as components on the Prefab I wish to save.
In addition to custom types, my Prefab has two BoxCollider2Ds, references to which seem to successfully save when I ES3.Save the Prefab. This can be confirmed by viewing the save file at the persistent data path.

My problem occurs when I try to load the Prefab. One of the two BoxCollider2D is missing, breaking the functionality of my Prefab.

The steps I take to reproduce in my scene:
Press play
Hit save button to save Prefab
Press pause
Delete Prefab from scene
Press play
Hit load button, which instantiates my Prefab but without one BoxCollider2D
User avatar
Joel
Moodkie Staff
Posts: 4848
Joined: Wed Nov 07, 2012 10:32 pm

Re: BoxCollider2D not loading

Post by Joel »

Hi there,

Have you tried right-clicking the GameObject which the Colliders belong to and selecting Easy Save 3 > Add References to Manager while the scene you're saving and loading in is open?

For more information please see the Saving and Loading References guide:

https://docs.moodkie.com/easy-save-3/es ... eferences/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Ptolemie
Posts: 7
Joined: Mon Apr 24, 2023 8:45 pm

Re: BoxCollider2D not loading

Post by Ptolemie »

Hey there, I definitely missed that step, but after following the steps to add my prefabs' references to the manager while the scene they are in was open, the problem persists. It's not unexpected, with the level of complexity involved in my prefabs. What's surprising is that this is effecting the BoxCollider2D and CircleCollider2D components instead of only my own wacky ones lol.

A little more info on my situation. The prefab with which I'm testing implementation has two BoxCollider2Ds, one 'enabled' the other 'disabled'. Upon loading the prefab, the 'enabled' collider is missing. Additionally, child objects' CircleCollider2Ds are also missing.

This is I'm sure the tip of the iceberg for my prefab's saving needs, but I'd like to iron out the provided components before tackling my own monstrosities.
Ptolemie
Posts: 7
Joined: Mon Apr 24, 2023 8:45 pm

Re: BoxCollider2D not loading

Post by Ptolemie »

I've confirmed the JSON file (I love the formatting ES3 provides) includes the missing colliders. If I press play, save the prefab, disable an enabled collider, and hit load, the collider reverts to its saved, 'enabled' state.
User avatar
Joel
Moodkie Staff
Posts: 4848
Joined: Wed Nov 07, 2012 10:32 pm

Re: BoxCollider2D not loading

Post by Joel »

Hi there,

Please could you replicate this in a new project with a simple scene and private message it to me with instructions so I can debug it at my end. Hopefully this will allow me to see what is happening :)

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Ptolemie
Posts: 7
Joined: Mon Apr 24, 2023 8:45 pm

Re: BoxCollider2D not loading

Post by Ptolemie »

While working on the simple scene to send over, I was unable to reproduce the bug. Meaning EasySave3 worked perfectly as expected. So I took a look in my project, and surprise surprise. The bug was occurring due to my own error.

In short, I failed to enable prefab saving on my prefab's nested prefabs. Now that I've done that, my colliders are loading in as expected!

I'm guessing the load function first takes into account the child game objects before the parent's other components, and that the absence of ES3Prefab component in my child objects broke the loading process in some way.

Anyway, my problem has been solved by carefully following the documented guidelines. Thanks for your help Joel!
User avatar
Joel
Moodkie Staff
Posts: 4848
Joined: Wed Nov 07, 2012 10:32 pm

Re: BoxCollider2D not loading

Post by Joel »

Glad you managed to resolve your issue, let me know if you run into anything else :)
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply