Auto add references when put in certain folders?

Discussion and help for Easy Save 3
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Auto add references when put in certain folders?

Post by Joel »

As it's an Editor script you would also need to provide code to persist the changes to the manager. The easiest way to do this is using Undo.RecordObject.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
poptarts4444
Posts: 18
Joined: Sat Jul 15, 2023 2:58 am

Re: Auto add references when put in certain folders?

Post by poptarts4444 »

Joel wrote: Tue Jul 18, 2023 7:15 am As it's an Editor script you would also need to provide code to persist the changes to the manager. The easiest way to do this is using Undo.RecordObject.

All the best,
Joel
ok found a solution that doesn't use an Editor script, but it works for my project :) thanks again!
poptarts4444
Posts: 18
Joined: Sat Jul 15, 2023 2:58 am

Re: Auto add references when put in certain folders?

Post by poptarts4444 »

Joel wrote: Tue Jul 18, 2023 7:15 am As it's an Editor script you would also need to provide code to persist the changes to the manager. The easiest way to do this is using Undo.RecordObject.

All the best,
Joel
Does ES3 have trouble working with Addressables? Or is there something I need to do to make it work?

The solution we spoke about last week worked perfectly for a week, but now it just doesn't. The only thing I've changed is I rebuilt the Addressables. All of the SOs I'm saving are coming up null like they were before my folder reference update solution. That solution is still being used, but it no longer matters.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Auto add references when put in certain folders?

Post by Joel »

We've had no reports of any issues with Addressables. Please could you replicate your issue in a new project with a simple scene and private message it to me with instructions so I can see what is happening.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
poptarts4444
Posts: 18
Joined: Sat Jul 15, 2023 2:58 am

Re: Auto add references when put in certain folders?

Post by poptarts4444 »

Joel wrote: Thu Jul 27, 2023 7:32 am We've had no reports of any issues with Addressables. Please could you replicate your issue in a new project with a simple scene and private message it to me with instructions so I can see what is happening.

All the best,
Joel
So I guess before I do that since it will take a while(would need to setup the addressable scene loading as well since that might be part of the problem), can you just quickly give a run down of what is needed to save and load SOs. I thought I did everything right, but maybe I didn't? So right now my ES3 reference manager has references to ALL the SO assets that could be loaded/saved. I've confirmed that they are all in there.

When the game saves the SOs now though, and I try to load again, they are just null. Both in build and if I load in the Editor. I assume this is cus it doesn't know the reference for the asset, even know they are in the reference manager. Is there a step I'm missing?

Also I should mention I'm only using Addressables right now to load scenes. I'm not loading SOs through Addressables at all. However, the SOs are in groups in the Addressables. I'm just not using it to load right now. Maybe I will in the future, but the game isn't huge so it shouldn't really need that.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Auto add references when put in certain folders?

Post by Joel »

Hi there,

ScriptableObjects are saved and loaded like any other UnityEngine.Object (see the Saving and loading classes, Components & ScriptableObjects section of the Getting Started guide for more info:

https://docs.moodkie.com/easy-save-3/ge ... bleobjects
When the game saves the SOs now though, and I try to load again, they are just null.
If it's null then that usually means that a reference to that specific object doesn't exist at the point of loading and it's being saved/loaded by reference, so an instance will not be created. However, it's not possible for me to tell what is happening in your case without being able to see a project which replicates it.

Also just to check, are you using the latest version of Easy Save?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
poptarts4444
Posts: 18
Joined: Sat Jul 15, 2023 2:58 am

Re: Auto add references when put in certain folders?

Post by poptarts4444 »

Joel wrote: Thu Jul 27, 2023 2:25 pm Hi there,

ScriptableObjects are saved and loaded like any other UnityEngine.Object (see the Saving and loading classes, Components & ScriptableObjects section of the Getting Started guide for more info:

https://docs.moodkie.com/easy-save-3/ge ... bleobjects
When the game saves the SOs now though, and I try to load again, they are just null.
If it's null then that usually means that a reference to that specific object doesn't exist at the point of loading and it's being saved/loaded by reference, so an instance will not be created. However, it's not possible for me to tell what is happening in your case without being able to see a project which replicates it.

Also just to check, are you using the latest version of Easy Save?

All the best,
Joel
Yes I'm using latest version!

So I made a new project, and it works... I knew this would happen lol. So all the SO loading works fine in the new project.

I made this video walking through the problem in my main project. I hope that is fine. I tried to go as quickly as possible... You can skip to 11:20 to see the problem where I play the same build 4 times in a row, but it's not until the 4th one that the load doesn't work.

https://youtu.be/OdNg8IekKqE

Please let me know if you want me to send you scripts or screenshots or anything.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Auto add references when put in certain folders?

Post by Joel »

Hi there,

Unfortunately a video isn't enough for me to be able to debug the issue. Please could you make a minimal version of your project with only the content required to replicate it and private message it to me so that I can see what is happening. Ideally with a new, basic scene with minimal logic as it wouldn't be possible for me to try to understand the complete logic of your project.

Looking at it, my best guess is that it's a timing issue. For example if a project relies on the Awake() methods of two different things being called in a specific order, despite the order of Awake() methods not being guaranteed.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
poptarts4444
Posts: 18
Joined: Sat Jul 15, 2023 2:58 am

Re: Auto add references when put in certain folders?

Post by poptarts4444 »

Joel wrote: Fri Jul 28, 2023 8:24 am Hi there,

Unfortunately a video isn't enough for me to be able to debug the issue. Please could you make a minimal version of your project with only the content required to replicate it and private message it to me so that I can see what is happening. Ideally with a new, basic scene with minimal logic as it wouldn't be possible for me to try to understand the complete logic of your project.

Looking at it, my best guess is that it's a timing issue. For example if a project relies on the Awake() methods of two different things being called in a specific order, despite the order of Awake() methods not being guaranteed.

All the best,
Joel
Like I said, I built a new project like this yesterday, but it's working fine. So there wouldn't be a reason to send it to you since it all works.

I'll keep debugging things so hopefully the problem will come up. I'll force a delay to check for the timing suggestion!
poptarts4444
Posts: 18
Joined: Sat Jul 15, 2023 2:58 am

Re: Auto add references when put in certain folders?

Post by poptarts4444 »

Joel wrote: Fri Jul 28, 2023 8:24 am Hi there,

Unfortunately a video isn't enough for me to be able to debug the issue. Please could you make a minimal version of your project with only the content required to replicate it and private message it to me so that I can see what is happening. Ideally with a new, basic scene with minimal logic as it wouldn't be possible for me to try to understand the complete logic of your project.

Looking at it, my best guess is that it's a timing issue. For example if a project relies on the Awake() methods of two different things being called in a specific order, despite the order of Awake() methods not being guaranteed.

All the best,
Joel
ok so I THINK it was a timing issue. Like loading while the scene is opening and saving while I quit the game will prevent a 'full' save? How do I prevent this from happening automatically? Right now the game saves when entering new scenes. What if someone quits right as it's entering a new scene and the save doesn't 'complete'?
Post Reply