Addressables during save/load?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Addressables during save/load?

Post by timbecile »

Hi Tony,

I've moved my levels into addressables and wondered if your save/load system inside the Dialogue system has any support for that?

If so, how is it implemented?
User avatar
Tony Li
Posts: 21070
Joined: Thu Jul 18, 2013 1:27 pm

Re: Addressables during save/load?

Post by Tony Li »

Hi,

Are you talking about actual scene files?

What's the reason for moving them into Addressables, unless you're pulling them in from a source external to the build?

The Dialogue System's save system uses SceneManager.LoadSceneAsync, so as long as your system is fine with that, then there should be no problem.
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Re: Addressables during save/load?

Post by timbecile »

There was a couple reasons to move to addressables. Mostly for the memory savings because Unity's horrible shader management. But also to allow for player modding of my game.

The load command for addressables is

Addressables.LoadSceneAsync(scene, LoadSceneMode.Single).Completed += SceneLoadComplete;

which is a different one from SceneManager.LoadSceneAsync.
User avatar
Tony Li
Posts: 21070
Joined: Thu Jul 18, 2013 1:27 pm

Re: Addressables during save/load?

Post by Tony Li »

I'll look toward supporting that in a future update. In the meantime, you could modify SaveSystem.cs and replace the SceneManager calls with Addressables calls.
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Re: Addressables during save/load?

Post by timbecile »

that's a perfect solution. I need a bool anyway because some levels still load the old fashioned way.

Thanks Tony!
User avatar
Tony Li
Posts: 21070
Joined: Thu Jul 18, 2013 1:27 pm

Re: Addressables during save/load?

Post by Tony Li »

Sounds good. This way SaveSystem wraps up the underlying load method (Addressables or SceneManager) so you don't have to think about it.

Version 2.2.12 just wrapped up and should be on the Asset Store in the next few days. I'll try to schedule this addition into version 2.3 if possible.
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Re: Addressables during save/load?

Post by timbecile »

Tony, where should I save the bool so I know it hits the right load command?
User avatar
Tony Li
Posts: 21070
Joined: Thu Jul 18, 2013 1:27 pm

Re: Addressables during save/load?

Post by Tony Li »

Hi,

I haven't yet worked out the details of how I plan to implement it. But, off the top of my head, I might use the scripting define symbol USE_ADDRESSABLES to try addressables first. Maybe write two versions of the LoadSceneInternal(string sceneName) method:

Code: Select all

#if USE_ADDRESSABLES
    private static IEnumerator LoadSceneInternal(string sceneName)
    {
        ... (try using addressables; failing that, use SceneManager) ...
    }
#else
    private static IEnumerator LoadSceneInternal(string sceneName)
    {
        ... (original method in SaveSystem.cs) ...
    }
#endif
Post Reply