Page 1 of 1

Prefab Variants not saved correctly?

Posted: Mon May 11, 2020 4:06 pm
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

Re: Prefab Variants not saved correctly?

Posted: Mon May 11, 2020 4:23 pm
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

Re: Prefab Variants not saved correctly?

Posted: Tue May 12, 2020 4:16 pm
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

Re: Prefab Variants not saved correctly?

Posted: Tue May 12, 2020 4:42 pm
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

Re: Prefab Variants not saved correctly?

Posted: Wed May 13, 2020 9:50 am
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