Hello,
I've got an issue where my Structs are saving just fine, but won't load correctly, however the other saved data loads in fine.
So I've got a class that contains some data along with a Struct Array of data. I have both the Struct "EnemySpawnData" And Class "MapZoneSpawnConfig" set to custom ES3 types. The save file for these are saved/loaded from Resources & it saves/loads fine, the for BattleZoneSpawnType, obsticleID, breakZoneType load just fine and the length of each struct array is there but there is no data for each element in the struct.
The data in the struct is just 1 string and 2 int & they show up fine in the .bytes file but don't load & instead the struct data is just left empty.
Save File:
The class that contains all the data:
Below is the ScriptableObject that loads the data, this image shows whats in there after loading and If you match it with the save file in the image above, the save file has the characterID "PurpleMushroom" with min/max spawn of 2 & 4, but the SO below loads nothing other than the length of the array.
Both are setup for custom ES3 Types just fine:
Any help would be great!
Thanks!
Issues loading a Struct
Re: Issues loading a Struct
Hi there,
I don’t appear to be able to replicate this. From what you’ve described it sounds like something else is changing the structs after they’ve been loaded.
Please could you replicate this in a new project with a simple scene which just saves and loads the structs without any other logic so the issue can be isolated to Easy Save.
All the best,
Joel
I don’t appear to be able to replicate this. From what you’ve described it sounds like something else is changing the structs after they’ve been loaded.
Please could you replicate this in a new project with a simple scene which just saves and loads the structs without any other logic so the issue can be isolated to Easy Save.
All the best,
Joel
-
- Posts: 4
- Joined: Mon Feb 14, 2022 3:36 pm
Re: Issues loading a Struct
Hay,
Just made a new project & was able to replicate this issue.
Want me to send you the project?
Just made a new project & was able to replicate this issue.
Want me to send you the project?
Re: Issues loading a Struct
Yes please. If you zip it and upload it to something or Google Drive or WeTransfer and private message it to me with instructions I’ll take a look.
All the best,
Joel
All the best,
Joel
-
- Posts: 4
- Joined: Mon Feb 14, 2022 3:36 pm
Re: Issues loading a Struct
Please check you DMs, thanks
Re: Issues loading a Struct
Hi there,
Just a heads-up that we’ve not forgotten about your PM. As support tickets which require us to download a project take much longer to respond to, we have a queue of these to work through (Jan and Feb are the busiest times of the year for us).
All the best,
Joel
Just a heads-up that we’ve not forgotten about your PM. As support tickets which require us to download a project take much longer to respond to, we have a queue of these to work through (Jan and Feb are the busiest times of the year for us).
All the best,
Joel
Re: Issues loading a Struct
Hi Alex, and thanks for your patience on this one.
The issue was because of the private property on a struct. This is frowned upon because it uses the struct in a mutable way, causing some very difficult-to-debug issues as a copy of the struct is made every time the setter is called, but this copy is not necessarily accessible elsewhere. In these cases you almost always want to use a class instead, but I trust that you know what you're doing
Although it's frowned upon, it's still valid syntax, so I've accounted for this when generating ES3Types. If you would like the update which resolves this issue, private message me your invoice number and I'll send it over.
All the best,
Joel
The issue was because of the private property on a struct. This is frowned upon because it uses the struct in a mutable way, causing some very difficult-to-debug issues as a copy of the struct is made every time the setter is called, but this copy is not necessarily accessible elsewhere. In these cases you almost always want to use a class instead, but I trust that you know what you're doing
Although it's frowned upon, it's still valid syntax, so I've accounted for this when generating ES3Types. If you would like the update which resolves this issue, private message me your invoice number and I'll send it over.
All the best,
Joel
-
- Posts: 4
- Joined: Mon Feb 14, 2022 3:36 pm
Re: Issues loading a Struct
Ah ok, thanks for that. I didn't know that about Struct and I've since updated my struct to use Public fields & this has fixed the issue
In no rush for the new update, I assume will come out in an official update at some point.
Thanks for the help and info!
In no rush for the new update, I assume will come out in an official update at some point.
Thanks for the help and info!