Saving/Loading an Array with prefabs creates empty objects?

Discussion and help for Easy Save 3
Post Reply
christoph
Posts: 4
Joined: Thu Oct 29, 2020 11:29 pm

Saving/Loading an Array with prefabs creates empty objects?

Post by christoph »

So I have something very weird happening working with Playmaker and Easy Save.

I select 4 level section prefabs randomly and afterwards I spawn them to create a level. I populate with these 4 prefabs an additional array and save the current level so I can later load it again. Meaning it's an array with 4 game objects in it.

I restart the game in the editor and the array gets populated correctly, but some of the saved gameobjects get automatically spawned or created when Easy Save loads that array. Interestingly enough, these prefabs are all empty, just the name is the same as the prefab of the level section.

Now I'm not even sure if by loading the array something like this is possible or if this is somehow clashing with other stuff that is running. But seems it's happening with Pool Boss spawning and as well with the default create/instantiating.

I use for everything Playmaker actions. But what could cause this?

I'm clearly doing something wrong here, so any help is appreciated.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving/Loading an Array with prefabs creates empty objects?

Post by Joel »

Hi there,

Please could you create a new project from scratch with a basic scene which replicates the issue and private message it to me? That should hopefully allow me to see what is happening.

Also just to check: have you right-clicked the base prefab in Assets and selected Enable Easy Save for Prefab?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
christoph
Posts: 4
Joined: Thu Oct 29, 2020 11:29 pm

Re: Saving/Loading an Array with prefabs creates empty objects?

Post by christoph »

Hi Joel,

thanks for the reply.

I actually didn't know about the setting to enable Prefabs. And yes, this spawns them now with all the children.

Is there a way to only load the reference back into the array though? because now Easy Save not only loads the prefabs from the array, it also creates them. And then Pool Boss spawns them again so I have the level twice in my game. I only would like to save the information in the array, not the gameobjects. But I clearly am missing the logic here. Because I thought it wouldn't take care of 'recreating' my entire level just because I saved it through EasySave...
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving/Loading an Array with prefabs creates empty objects?

Post by Joel »

Hi Christoph,

If your array contains GameObjects then this is what will be saved. If you don't want to save the entire GameObject, I recommend only saving the Components of the GameObjects which need to be saved, rather than the complete GameObject. You can then use the Load Into action to load the data into an existing instance or array of instances.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply