Prefab Variants not saved correctly?

Discussion and help for Easy Save 3
Post Reply
ckannon
Posts: 7
Joined: Mon May 04, 2020 5:04 pm

Prefab Variants not saved correctly?

Post by ckannon »

Hi all,

Has anyone had any success saving prefab variants?

I have a prefab called BaseShip, it looks like this.

Code: Select all

Baseship
 Inventory
 Equipment
 Colliders

And a variant that looks like this

Code: Select all

TestShip
 Inventory
 Equipment
 Colliders
  Plane
  Plane
  Plane
  Plane
I create my prefab variants from the initial BaseShip and add colliders to them that line up with the 2d sprites, I then save the prefab variant and add it to EasySave3 references. When I launch my game and create a test save, then reload - the ship reloads properly - but the Colliders child object is entirely empty. I have a feeling when it instantiates the prefab, it is instantiating the base prefab instead of the prefab variant that includes the required collider objects.

Any ideas?

Thanks,
Chris

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

Re: Prefab Variants not saved correctly?

Post by Joel »

Hi Chris,

If you're able to private message me a basic project which replicates this I'll be happy to look into it further :)

All the best,
Joel
Joel @ Moodkie Interactive
Twitter - Unity

ckannon
Posts: 7
Joined: Mon May 04, 2020 5:04 pm

Re: Prefab Variants not saved correctly?

Post by ckannon »

Hey Joel,

I'm going to pivot a bit and see if we can just save the things that are different about each prefab and then instance them manually, basically a skeleton object will be saved for each entity that has a prefab reference and things like position etc. Then we can just load that collection and iterate and instance each prefab, replacing the properties as we go.

I think the idea of saving the entire scene using ES3.Save for each saveable GameObject is great in theory, but the complexity of our project and heavy use of prefabs seems to make it unstable.

Thanks again,
Chris

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

Re: Prefab Variants not saved correctly?

Post by Joel »

Hi Chris,

That would be the most efficient way of doing things, especially for larger projects where there might be a lot of information which doesn't need to be saved.

All the best,
Joel
Joel @ Moodkie Interactive
Twitter - Unity

Liens
Posts: 16
Joined: Thu May 07, 2020 9:06 am

Re: Prefab Variants not saved correctly?

Post by Liens »

In the past whenever I make a prefab variant, I have had to go and use 'Reset' on the ES3Prefab script to give the variant a new Prefab ID. Otherwise it conflicts with the original prefab, maybe it is the same for this thread's issue.
I've found that for nested prefabs, you'll also need an ES3Prefab on the inside prefabs as well.

This was a few versions ago but I think it still applies

Post Reply