microsoft / gdk-unity-package

The Unity package for PC GDK developers.
Other
51 stars 18 forks source link

XGameSaveWrapper multiple calls to callback in one method #106

Closed TheSLAP closed 1 year ago

TheSLAP commented 1 year ago

If you look at XGameSaveWrapper.Load, the callback can be first made if it fails to create save container and then against after it attempts to read blobs. This makes little sense to me and I think is poor practice. The callback should only be called once when the method has completed and not potentially multiple times. Unless there is some reasoning for this, I think this should be resolved to save users future headaches if they are awaiting the callback via TaskCompletionSource or other means.

tculotta commented 1 year ago

Thanks for spotting this. I saw there are a few other places in that wrapper that behave the same way. I just pushed a fix which will be included in the next release, and in the meantime, you can pull in the new version of the script to your project.