Added type saves wrong

Discussion and help for Easy Save 3
Post Reply
Moonman
Posts: 6
Joined: Fri Jan 07, 2022 10:49 am

Added type saves wrong

Post by Moonman »

Hello. I've added manually through editor a type to be saved and loaded. It contains primitive types - but it saves null without errors in logs.

Code: Select all

    public void SaveData()
    {
        ES3.Save("Society", society);

        Debug.Log("society==null " + society == null); // "False"

// Test
        society.population = 0;
        Society societyTest = ES3.Load("Society", society);
        Debug.Log("society1==null " + societyTest == null);	//"False"
        Debug.Log("pop: " + societyTest.population);		//NullReferenceException

    }

https://imgur.com/a/kNRExKq

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

Re: Added type saves wrong

Post by Joel »

Hi there,

Please could you send me the Society class so that I can test this at my end.

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

Moonman
Posts: 6
Joined: Fri Jan 07, 2022 10:49 am

Re: Added type saves wrong

Post by Moonman »

Hello, I've sent via PM

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

Re: Added type saves wrong

Post by Joel »

Thanks for sending that over, though I wasn't able to replicate your issue.

Please could you replicate this in a new project with a simple scene which isolates the issue to Easy Save and private message it to me with instructions.

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

Moonman
Posts: 6
Joined: Fri Jan 07, 2022 10:49 am

Re: Added type saves wrong

Post by Moonman »

Joel wrote:
Mon Jan 10, 2022 1:13 pm
Thanks for sending that over, though I wasn't able to replicate your issue.

Please could you replicate this in a new project with a simple scene which isolates the issue to Easy Save and private message it to me with instructions.

All the best,
Joel
Thank you for replying, I've built and sent a project via pm

Moonman
Posts: 6
Joined: Fri Jan 07, 2022 10:49 am

Re: Added type saves wrong

Post by Moonman »

I find that in a new project it works fine, but in my game it always dropped NullReferenceExpectation after accessing to "loaded" object.
In the clean roject ES3 generated a class

Code: Select all

    public class ES3UserType_Society : ES3ObjectType
, while in my game it was

Code: Select all

public class ES3UserType_Society : ES3ComponentType
I've chacged the base clas and it started to work correctly.
Thanks.

Post Reply