Page 1 of 1

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

Posted: Wed Jul 29, 2020 11:53 pm
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.

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

Posted: Thu Jul 30, 2020 6:46 am
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

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

Posted: Thu Jul 30, 2020 8:50 am
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.

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

Posted: Thu Jul 30, 2020 9:31 am
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.

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

Posted: Thu Jul 30, 2020 10:02 am
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?

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

Posted: Thu Jul 30, 2020 10:10 am
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