Test your project in Play mode
It's possible to test some aspects of your Microsoft GDK based project using the Unity Editors built in Play mode. However, you must first satisfy the following requirements:
- Create a valid MicrosoftGame.config that exits alongside the executing process, in this case Unity.exe.
- Correctly initialize and uninitialize the Microsoft GDK. Paired API calls must be matched when entering and exiting Play mode.
Create a valid MicrosoftGame.config
Before calling SDK.XGameRuntimeInitialize()
a valid MicrosoftGame.config file must exist alongside the executing process. In the case of the Unity Editor and its Play mode, this is Unity.exe
.
To achieve this, use the following steps:
- Locate the MGC Asset you want to use.
- Go to Assets > Show In Explorer.
- Copy and paste the
.mgc
file to the location containingUnity.exe
. - Rename the file to
MicrosoftGame.config
.
Note
Changes to the MicrosoftGame.config, after calling SDK.XGameRuntimeInitialize()
, won't be picked up and will require an Editor restart. This is a known issue.
Correctly initialize and uninitialize the Microsoft GDK
The Microsoft GDK Tools package doesn't initialize or uninitialize the API on your behalf. You must ensure that your script code does this, and that matched pairs are called as expected when entering and exiting the Unity Editor Play mode. Failure to do so might lead to unexpected results or errors whilst testing your project.
For example, a call to SDK.XGameRuntimeInitialize()
must be matched with a subsequent call to SDK.XGameRuntimeUninitialize()
.
Neither the Unity Editor or the Microsoft GDK Tools package is able to clean unmatched API calls.