Textures being loaded from another scenes

Discussion and help for Easy Save 3
Post Reply
JoseHawk
Posts: 25
Joined: Tue Sep 22, 2020 12:51 pm

Textures being loaded from another scenes

Post by JoseHawk »

Hello,

After long time using EasySave and now working in the performance and optimization, we have realised that most of the memory consumption is due to EasySave. When debugging with the profiler, we have notified that a lot of textures are being loaded that even does not apply to the current scene. Even when loading the main screen in a fresh running, textures from another scenes are being loaded on this scene, that is the first one.

What could be wrong? I am sure it has be with some bad configuration of the tool or any other stupid mistake, but I cannot find the route case.

In the worst case, we don't need to save anything related to textures as we mainly need to record simple primitive variables, so if there is an easy way to disable any kind of textures saving, that would be enough.

I attach you a memory snapshot about what I mean, where you can realise that 80% of the memory consumption is due to this.

Thank you in advance.

Cheers!
Attachments
MemorySnapshot.png
MemorySnapshot.png (300.69 KiB) Viewed 1054 times
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Textures being loaded from another scenes

Post by Joel »

Hi there,

This usually means that there is an Easy Save 3 Manager in your scene which is automatically gathering the dependencies of your scene so that they can has a persistent ID assigned to them in order to save and load them by reference. For this reason sometimes Unity will attribute memory usage to Easy Save because it comes across our reference to that object first, but we only reference it because something else in your scene references it.

In some cases there are references in the manager which are no longer dependencies of your scene, which sounds like the case in your situation. In this case you can press the Optimize button on the Easy Save 3 Manager's ES3ReferenceMgr Component to remove them from the manager.

However, if you're only saving primitive types then you shouldn't need an Easy Save 3 Manager in your scene, so deleting it will resolve your issue.

If you do decide to keep the reference manager, if you send me your invoice number on moodkie.com/contact then I can send over our upcoming update as there's a bug in the current version where the Optimize button won't remove all redundant references.

You can find out more about the reference manager here:
https://docs.moodkie.com/easy-save-3/es ... eferences/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
JoseHawk
Posts: 25
Joined: Tue Sep 22, 2020 12:51 pm

Re: Textures being loaded from another scenes

Post by JoseHawk »

Hi @Joel,

Thanks for the feedback. I will try to take a look to everything that you have said.

Regarding the "remove the Easy Save Manager", I am also storing List of primitives, is that okay as well? List interface is itself not a primitive type.

About having an updated version, I am going to send you an email, so you can share that update with me ;)

Thank you in advance!

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

Re: Textures being loaded from another scenes

Post by Joel »

Hi there,

Lists of primitives are fine. Only objects which derive from UnityEngine.Object (e.g. GameObjects, ScriptableObjects, MonoBehaviours, etc) will be saved and loaded by reference :)

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
JoseHawk
Posts: 25
Joined: Tue Sep 22, 2020 12:51 pm

Re: Textures being loaded from another scenes

Post by JoseHawk »

Hi again,

After trying to upgrade to the version you sent me, I get compilations errors such as:

Assets\Plugins\Easy Save 3\Scripts\Auto Save\ES3AutoSaveMgr.cs(8,24): error CS0234: The type or namespace name 'IncludeInSettingsAttribute' does not exist in the namespace 'Unity.VisualScripting' (are you missing an assembly reference?)

Do I need any specific version of Unity or any library?

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

Re: Textures being loaded from another scenes

Post by Joel »

Hi there,

It looks like you're using an old version of Unity Visual Scripting (current version is 1.8.0). You will need to use 1.5.2 or newer as IncludeInSettings wasn't included before this version (you can update from Window > Package Manager).

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
JoseHawk
Posts: 25
Joined: Tue Sep 22, 2020 12:51 pm

Re: Textures being loaded from another scenes

Post by JoseHawk »

Hello again,

I would like to confirm with you some details:

- Should I go scene by scene clicking in the "Optimize" button? Would it make any difference removing the "Easy Save 3 Manager" and adding it again?
- Is it okay to unmark "Auto Update References" and "Use Global References"? Is there any documentation where I can read what all these parameters mean? I barely found some information in the official documentation
- If I am defining the ES3Settings by code (so I have different settings by platform), what are the parameters related to the ones from the interface for the previous ones I mentioned you? If there is not way to modify them by code, which values do they take?

This my ES3Settings initialization:

Code: Select all

      private void InitializeMemorySettings()
        {
            MemorySettings = new ES3Settings
            {
                location = ES3.Location.File,
                directory = ES3.Directory.PersistentDataPath,
                path = SaveFileName.MAIN_FILE,
                encryptionType = ES3.EncryptionType.None,
                saveChildren = false,
                format = ES3.Format.JSON,
                prettyPrint = true,
                bufferSize = 2048,
                referenceMode = ES3.ReferenceMode.ByValue,
                serializationDepthLimit = 64
            };
        }
Thank you in advance and have a great day!

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

Re: Textures being loaded from another scenes

Post by Joel »

Hi there,
Should I go scene by scene clicking in the "Optimize" button?
Correct, you would need to do this for every manager.
Would it make any difference removing the "Easy Save 3 Manager" and adding it again?
This will regenerate all of your reference IDs, so any save data using the old IDs will be invalid. However, if this isn't an issue for you then this will also work.
Is it okay to unmark "Auto Update References"?
You an read about the implications of unmarking "Auto Update References" here:
https://docs.moodkie.com/easy-save-3/es ... erformance
Is it okay to unmark "Use Global References"?
This is only used internally so it's not recommended to uncheck this. This is simply used to maintain reference IDs across scenes and doesn't make any difference to the size of a scene or a build (it's only used in the Editor).

The two guides which document the options which aren't only used internally are here:
https://docs.moodkie.com/easy-save-3/es ... eferences/
https://docs.moodkie.com/easy-save-3/es ... rformance/
If I am defining the ES3Settings by code (so I have different settings by platform), what are the parameters related to the ones from the interface for the previous ones I mentioned you? If there is not way to modify them by code, which values do they take?
ES3Settings are for defining runtime settings. Auto Update References and Use Global References are Editor settings and don't affect anything which happens at runtime or in a build, so are not in the ES3Settings object.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
JoseHawk
Posts: 25
Joined: Tue Sep 22, 2020 12:51 pm

Re: Textures being loaded from another scenes

Post by JoseHawk »

Thank you so much the reply!

I will take a look to everything and will let you know. Hopefully the issue will be fixed =)

Cheers!
Post Reply