microsoft / gdk-unity-package

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

Running in Unity Editor doesn't work for specific APIs (Packages and Game Invite) #103

Open eamonwoortman opened 1 year ago

eamonwoortman commented 1 year ago

Package and system info

Disclaimer

I'm well aware the minimum supported Unity version of this package is 2017.x, but the runtime/built game is working fine with this package. Our game is currently live with the Login, Storage, Achievements and Rich Presence features successfully implemented.

Short description (TLDR)

GDK Unity Editor logic seems to work fine for the API's that cover Login, Storage and even Achievements, but fails for the Packages and Game Invite API's. These features do work when we make a standalone build and test it there.

Description

We're currently implemented DLCs using the Packages API and in order to iterate more quickly, I figured I'd upgrade to the latest 2207 package which supports Unity Editor playthroughs.

After updating the MicrosoftGame.config file with the latest requirements, I ran the game in the Unity Editor. I could see basic initialization working and features like login, storage and achievements were working.

However, when trying to leverage the Packages API to retrieve a list of packages(SDK.XPackageEnumeratePackages(...)), it returns a non-successful HRESULT: -2147023728 (0x80070490). The error itself can't be found on the MS GDK documentation website. After googling a bit, it seems like the error is something like "Package not found".

Similarly, registering for game invite events also returns an error: -2147009196 (0x80073D54). Like the packages error, this one was also not in the MS documentation website. Some Google search results seem to match the error description "The process has no package identity".

I did some digging in the inner workings of the xgameruntime (cough disassembly), it occurred to me that it might be querying GetCallingProcessPackageFullName or similar, which could return that -2147009196 error code. I'm not sure if that is the case, but if it is, it might be querying the Windows Store with the running process (Unity.exe), which isn't the package we're looking for. 👋

Question Have you guys have tested and confirmed the Packages and Game Invite API's working in the editor? And perhaps other API's that rely on the active process handle?

I realize Editor run-throughs are not the highest priority but having a very large project, it does save a ton of time not having to spend to creating builds.

Short summary API methods that we used

Here's a short summary of methods that don't work and the ones that do;

Not working;

SDK.XPackageEnumeratePackages returns: -2147023728 (0x80070490) SDK.XGameInviteRegisterForEvent returns: -2147009196 (0x80073D54)

Working;

SDK.XGameRuntimeInitialize (runtime init) SDK.XBL.XblInitialize (xbox live init) SDK.XUserRegisterForChangeEvent (login) SDK.XGameSaveInitializeProviderAsync (storage) SDK.XBL.XblAchievementsUpdateAchievementAsync (achievements)

tculotta commented 1 year ago

Thank you for bringing this to our attention! Currently these DLC APIs are not supported in non-packaged scenarios unfortunately. Our teams are looking at adding documentation and a more specific error response to make this clearer for the future.

XGameInvite APIs on the other hand are something we'll be looking into in the coming weeks as we believe that should be able to be fixed for this scenario.

eamonwoortman commented 1 year ago

Thanks for the update.

Do you have any insight into whether support for editor-runtime DLC APIs will ever be added (if at all)?