Page 1 of 1

Problems with saving SpriteRenderers

Posted: Sat Feb 27, 2021 4:13 am
by DeliInteractive
We just bought the tool and we've found an issue with saving and loading GameObjects with SpriteRenderer components on them. In our case, we found that, when non-standard materials were attached to specific sprite renderers, the objects would load with untextured default materials. In attempting to test that with a new empty project, we came across an additional issue where the SpriteRenderer would load without a sprite even after assigning a sprite on the prefab thus altering the prefab itself. We've included a link to download the project here.

Our method:

1. Create prefab with an attached sprite renderer

2. Save and load the GameObject

3. Assigned sprite should be cleared and changed to none

[Link removed]

Re: Problems with saving SpriteRenderers

Posted: Sat Feb 27, 2021 10:40 am
by Joel
Hi there,

Please could you only send links to projects via private message in the future, as publicly sharing the Easy Save package is against the EULA.

Regarding this issue, this is because the Sprite is marked at NotEditable, and this was previously considered to mean that it was not serializable at runtime. However, if we're serializing it by reference then this isn't an issue, so I've created a version of Easy Save which ignores the NotEditable flag if storing by reference.

If you private message me your invoice number I will send this update over.

Regarding non-standard Materials, only the standard Material properties can be serialised at runtime, as there's no way of being able to automatically determine what properties a custom Material will have. In this case you would need to manually assign your Material to the object.

All the best,
Joel

Re: Problems with saving SpriteRenderers

Posted: Wed Mar 24, 2021 2:44 am
by treecki
I'm having a similar issue with being able to load Sprite Renderers. I know sprites are specifically saved by reference instead of by properties so I believe the issue has to due with a reference breaking with the object changing from one scene to the next. What was the specific solution to this issue with loading the sprites?

Re: Problems with saving SpriteRenderers

Posted: Wed Mar 24, 2021 8:19 am
by Joel
Hi there,

I've replied to your post in the other thread.

All the best,
Joel