Hi,
I'm hoping to get some support on an issue I'm having. I'm trying to save a scriptable object called CardData with ES3. One of the fields in CardData is CardImage, a reference to a Sprite. When I save CardData to Cache and then reload it within the same scene, CardImage loads back with the correct reference, but if I try to load CardData saved in a file from a previous session into a scene, the CardImage sprite is null.
Do you have any suggestions for how to save a reference to a sprite such that it will load properly in a later session?
Thanks,
Shaun
Update: I resolved this issue myself by replacing the Sprite reference with an Addressables AssetReference, which I was pleasantly surprised to find serialized perfectly with ES3 after creating a user type for it. As a side benefit, it seems like loading Sprites Async with Addressables might have sped my game up a tad too.
Loading Sprite Reference from File not Working
-
- Posts: 5
- Joined: Wed May 05, 2021 11:09 pm
Re: Loading Sprite Reference from File not Working
Hi there,
Glad you managed to resolve your issue. This issue would be because Unity creates a copy of the Sprite in certain situations, a reference to which will no longer exist between sessions. Your use of addressables seems to have circumvented this
All the best,
Joel
Glad you managed to resolve your issue. This issue would be because Unity creates a copy of the Sprite in certain situations, a reference to which will no longer exist between sessions. Your use of addressables seems to have circumvented this
All the best,
Joel