Search Issue Tracker

Fixed in 2022.2.X

Fixed in 2022.1.X

Votes

1

Found in

2019.4

2019.4.34f1

2020.3

2021.2

2022.1

2022.2

Issue ID

1399538

Regression

No

UnityEngine.Application.identifier returns an empty string when called in UWP Build

How to reproduce:
1. Open the attached project "identifier.zip"
2. Open File>Build Settings...
3. Switch Platform to Universal Windows Platform
4. Build And Run the project
5. Open %USERPROFILE%\AppData\Local\Packages<productname>\TempState\UnityPlayer.log

Expected results: "package name: com.DefaultCompany.NewUnityProject7"
Actual results: "package name:"

Reproducible with: 2019.4.36f1, 2020.3.29f1, 2021.2.11f1, 2022.1.0b7, 2022.2.0a4

  1. Resolution Note (fix version 2022.2):

    Fixed in 2022.2.0a9

    Workaround: you can retrieve application identifier on UWP by using this code:

    static string GetApplicationIdentifierWithUWPWorkaround()
    {
    #if UNITY_WSA && ENABLE_WINMD_SUPPORT
    return Windows.ApplicationModel.Package.Id.Name;
    #else
    return Application.identifier;
    #endif
    }

  2. Resolution Note (fix version 2022.1):

    Fixed in 2022.1.0f1

Comments (3)

  1. LucasSupportSquare

    Jan 24, 2023 08:38

    For anyone who wants to use the workaround, in my Unity version (2021.2.13f1) I had to change
    return Windows.ApplicationModel.Package.Id.Name
    to
    return Windows.ApplicationModel.Package.Current.Id.Name;
    in order to make it work.
    Thanks for providing it!

  2. Tautvydas-Zilys

    May 05, 2022 01:51

    Hey @peachypixels,

    we don't plan to backport this to 2020 & 2021 simply because it was never implemented on UWP and it was treated as a new feature. However, I added a workaround you can use in 2020.3 & 2021.3 in the resolution notes.

  3. PeachyPixels

    May 04, 2022 09:30

    It would be great if this could be fixed in 2020 & 2021 as well. Thank you!

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.