Loading Sprite Reference from File not Working
Posted: Thu May 13, 2021 8:27 pm
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.
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.