.byte files saved from scriptable object not working...

Discussion and help for Easy Save 3
Post Reply
NervousF
Posts: 4
Joined: Wed Jul 29, 2020 11:36 pm

.byte files saved from scriptable object not working...

Post by NervousF »

Hello,
Long story short I want to save my scriptable objects. I have two types: BasePlayer and BaseItem. (Pretty standard) When I save the item I get a standard .byte file with all the data that is fine. However, when I try load the data into a scriptable object I get an error. Not sure what to mess with at this point. Can anyone offer a solution? Below is the error shown. The debuts were me just trying to find out what was happening.
Attachments
Capture-8.PNG
Capture-8.PNG (27.12 KiB) Viewed 1571 times
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: .byte files saved from scriptable object not working...

Post by Joel »

Hi there,

Please could you show me the code you're using to save and load? It looks like you're saving an object as a ScriptableObject but trying to load it as a specific type.

Also have you changed any of the default settings at all?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
NervousF
Posts: 4
Joined: Wed Jul 29, 2020 11:36 pm

Re: .byte files saved from scriptable object not working...

Post by NervousF »

Hello,
Thanks for the swift reply. I will send the code in 15mins.
Not at the computer currently. But I am pretty sure I tried doing a specific type then couldn't so I done a generic type then cast into a specific but that still didn't working.
NervousF
Posts: 4
Joined: Wed Jul 29, 2020 11:36 pm

Re: .byte files saved from scriptable object not working...

Post by NervousF »

Hello Joel,

Sorry I was running over it to ensure that I wasn't making a stupid mistake. I have that running now. I saved a specific type. Then loading to a generic. So stupid, thanks for the lightbulb moment.
NervousF
Posts: 4
Joined: Wed Jul 29, 2020 11:36 pm

Re: .byte files saved from scriptable object not working...

Post by NervousF »

Hello,
Last question, since your saving relies on AssetDatabase.Refresh(); How can you build a standalone client? Since that function is editor based?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: .byte files saved from scriptable object not working...

Post by Joel »

Hi there,

The only thing which relies on AssetDatabase.Refresh() is if saving and loading from Resources, because Unity needs to be made aware of the files which have been added to Resources (this is a limitation at their end rather than ours). Just to clarify, you cannot add files to Resources at runtime.

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