Microsoft GDK Package: Questions about build process

Hello,

We are porting our existing game to MS Store (PC only).
We are using Microsoft GDK Package (https://discussions.unity.com/t/unity-and-microsoft-announce-the-microsoft-gdk-packages-for-unity-for-unity-2021-and-2022-lts/).

Windows computer,
Unity 2021.3.14f1
Windows SDK 10.0.22621.3233 (10.1.22621.3233 written below)
Windows SDK 10.0.26100.1 (10.1.26100.1 written below)

  1. We are trying to build with “Create Microsoft Store Package” set to true, and build fails with error:
BuildFailedException: FAILED - 'makepkg.exe pack ...' (3):

Stderr:
StoreLogo was not found: C:\Users\cguser17\Downloads\proj_build_dir\StoreLogo.png.
Square150x150Logo was not found: C:\Users\cguser17\Downloads\proj_build_dir\Square150x150Logo.png.
Square44x44Logo was not found: C:\Users\cguser17\Downloads\proj_build_dir\Square44x44Logo.png.
SplashScreenImage was not found: C:\Users\cguser17\Downloads\proj_build_dir\SplashScreenImage.png.
Square480x480Logo was not found: C:\Users\cguser17\Downloads\proj_build_dir\Logo480.png.

Missing logo file - Error Code: 0x80070002

We see that correct icons are generated in Assets/ folder of our Unity project.
But they are not copied to proj_build_dir (build dir) during build.

We made a temporary fix by copying icons in post-process to built project dir.
Then a next error arised during build:

Failed to get string resources from a resources.pri file for this package
Please make sure that your resources.pri contains references to string resources and is located in the same directory as your appxmanifest.xml or MicrosoftGame.config.
Strings expected to have a localized version: ms-resource:PackageTitle, ms-resource:PackageDescription, ms-resource:PackageTitle, ms-resource:PackageDescription

We fixed it also by copying resources.pri to built project dir.

Do we need to copy generated icons and resources.pri to build dir manually in our own postprocess?
Or this is a bug in com.unity.microsoft.gdk.tools and icons should be copied by package code?

  1. Also looks like there are an issue with
com.unity.microsoft.gdk.tools/Editor/GdkPostBuild.cs

It has a callbackOrder = 0, and executed before other post-processes in project.
So we couldn’t execute our own post-process to copy icons and resources.pri before GdkPostBuild.

To allow our own post-process to copy icons and resources.pri to built project dir before GdkPostBuild does it job we added com.unity.microsoft.gdk.tools as embedded package and changed callback order of GdkPostBuild to 2000 in source code.
This way GdkPostBuild executing after our post-process.

This is an inconvenient solution that is difficult to maintain because the plugin becomes difficult to update.
Can you please increase callbackOrder to some high value in package code?
Should we report a bug on this on Unity’s issuetracker?

Hi @Petr77777

Unity 2021.3.14f1 is not an officially supported version of the Editor for this package. The earliest version would be 2021.3.38f1, but when possible we would recommend going with the latest version of the required editor stream.

However with respect to the issue that you are seeing it’s worth checking that the “Shell Visual Mode” in your GDK Settings is not set to Disabled.

Most users would likely want Run Make Pri And Copy once the Game Config has been configured for Shell Visuals.

From the documentation:

Run Make Pri and Copy: The build process will attempt to run the MakePri.exe command line tool to generate the resources.pri file. On completion, both the resources.pri file and image resources will be copied to the build output folder.

Hope this helps,
Shaun

1 Like

Thank you, I’ve missed this.

We found that one of third-party plugins related to obfuscation cleans the build folder in its pre-process.
And this plugin also removed icons and resources.pri which were copied before to build dir.
We disabled this obfuscation plugin it and now all working fine.

1 Like

One more question about build and setup:

We see that during setup and build multiple files are generated:

GDKSettings.cs
Layout.resfiles
Pri.resfiles
Priconfig.xml
Resources.pri
Resources.resfiles
Resources.resw
en-US/Resources.resw

Can you tell us please which of them should be commited to VCS?

GDKSettings.cs: Regenerated when the ‘Regenerate On Build’ checkbox is enabled, see: Project Settings -> Microsoft GDK for your active GDK Settings.

Generally, once the TitleId and SCID are fix there isn’t much need to have this re-generated however it’s fast so should not present a problem. Also, if you disable the regenerate setting be mindful that later changing the TitleID or SCID in the MGC could cause a discrepancy.

Shell Visuals: Resources.Pri is built by the MakePri.exe tool. The other files are either inputs to this tool or resources which need to be transferred to the final build location, these other files should be added to VCS.

With respect to the Resources.Pri, you have a couple of choices. Build it ahead of time or rebuilt it at build time. The method you go with will affect the choice you make for the Shell Visuals Mode setting and if you want it in VCS or not.

We’ve tried to offer flexibility to accommodate different workflows. Adding the generated files to VCS shouldn’t cause a problem other than the VCS will likely see them change post build.

1 Like