ES3Prefab.Awake causing sudden long load times

Discussion and help for Easy Save 3
anthonyuccello
Posts: 2
Joined: Mon Aug 06, 2018 11:14 pm

ES3Prefab.Awake causing sudden long load times

Post by anthonyuccello »

Hello

I recently added Easy Save 3 to my project and added the ES3 Prefab component to my units. When I go to load my units now it takes 10 seconds (before it was near instant). In the profiler it is coming down to the ES3Prefab.Awake() call.
p1.png
p1.png (18.74 KiB) Viewed 6534 times
Can you advise why this is suddenly so slow and what might be a possible fix?

Each time I instantiate a prefab, I get a major slow down on this call.

When I delete Easy Save, this time drops instantly from 8 seconds to 20 millseconds:
p2.png
p2.png (22.56 KiB) Viewed 6533 times
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3Prefab.Awake causing sudden long load times

Post by Joel »

Hi there,

We've had no other reports of this causing a slow down. All the ES3Prefab.Awake method does is gets a reference to the manager, and then adds the references from the prefab to a Dictionary in the manager.

Please could you PM me a basic project which replicates this?

Also to establish whether it's getting the manager which is slowing things down, before calling any Easy Save code, please could you add the following line to your code and see if this speeds up the calls:
ES3Internal.ES3ReferenceMgrBase.Current;
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
anthonyuccello
Posts: 2
Joined: Mon Aug 06, 2018 11:14 pm

Re: ES3Prefab.Awake causing sudden long load times

Post by anthonyuccello »

Sorry I am unable to provide a sample project.

For now I have removed it, if I add it back I will check the line you posted.

Thanks.
EasySaver
Posts: 5
Joined: Mon Aug 06, 2018 1:33 pm

Re: ES3Prefab.Awake causing sudden long load times

Post by EasySaver »

Hey,

I have been experiencing this exact same issue (except it is taking around a second per object to instantiate) and it is all coming down to the Awake() call as well. And where would that line of code be used?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3Prefab.Awake causing sudden long load times

Post by Joel »

Hi there,

Please could you PM me a project and instructions to replicate it, as we've not yet been provided with a way to replicate it?

Also one more thing to try. Please could you try calling the following code in your scene and see if it causes a slow down for you?
var mgr = ES3Internal.ES3ReferenceMgrBase.Current;
This basically initialises Easy Save 3's Manager, so if this line causes a slow-down it'll mean this is what is causing the issue.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
EasySaver
Posts: 5
Joined: Mon Aug 06, 2018 1:33 pm

Re: ES3Prefab.Awake causing sudden long load times

Post by EasySaver »

Here is a test scene where it instantiates a larger pool of objects, it works fairly quickly on the first few spawns but begins to slow down around the 3-4th time.
The problem in my project is even slower, could it have to do with the total amount of different prefabs? or because my scene is larger and has more already existing objects?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3Prefab.Awake causing sudden long load times

Post by Joel »

Hi there,

I've deleted your attachment as it was publicly available and contained the entire Easy Save package. However, I downloaded it and will give it a go when I'm back in the office in the morning (it's 11pm here at the moment).

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
EasySaver
Posts: 5
Joined: Mon Aug 06, 2018 1:33 pm

Re: ES3Prefab.Awake causing sudden long load times

Post by EasySaver »

Sorry about that! i was mistaken in thinking this forum was private
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3Prefab.Awake causing sudden long load times

Post by Joel »

Thanks for sending that over, I really appreciate it.

In the case of your project, this is to be expected as you're instantiating 201 GameObjects in a single frame.

For each prefab you instantiate, Easy Save has to convert all local references into global references so that they can be serialised. In your project, each prefab contains 22 references, which equates to 4422 Dictionary lookups to resolve the references, which is what causes the slowdown.

If you only need to instantiate your prefab and do not need to save any variables on it, you can comment out the Awake() method of the ES3Prefab.cs script. However, if you need to save variables of the prefab, you will be better off removing the ES3Prefab script from your prefab and following THIS example. This is the most efficient way of saving and loading a large number of prefabs.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
EasySaver
Posts: 5
Joined: Mon Aug 06, 2018 1:33 pm

Re: ES3Prefab.Awake causing sudden long load times

Post by EasySaver »

Thanks,
In my case the delay occurs when i am instantiating way less objects than in that example scene, even just 4 objects.
Not sure what could be causing it apart from having quite a few different prefabs and a lot of object that are in the scene which seem to be referenced by the reference manager.

I will try replicate it better in the example/find more information on what is causing it. Otherwise i will try your linked example

Thanks!
Post Reply