Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.33f1

2022.3.15f1

2023.2.4f1

2023.3.0a19

Issue ID

UUM-59222

Regression

No

Unity Purchasing initialize performance cost is too high when creating a StandardPurchasingModule

-

How to reproduce:
1. Open the “UnityPurchasingPerformance.zip” project
2. Open the “SampleScene”
3. Enter Play Mode
4. Press the "Test StandardPurchasingModule" a single time.
5. (Optional)
5.1 You can call "Test UDP Name" to see the milliseconds elapsed for the UDP.Name property alone to see that it is indeed the performance bottleneck.
5.2 You can call "Test Fix" to see a fixed version with the suggested code changes.

Expected result: “Standard Purchasing Module” creation time does not exceed 2-3 milliseconds
Actual result: “Standard Purchasing Module” creation time exceeds 20 milliseconds

Reproducible with: 2021.3.33f1, 2022.3.14f1, 2023.2.4f1, 2023.3.0a19

Reproducible on: Windows 10(by reporter), Windows 11
Not reproducible on: no other environment tested

Note:
- The user has provided a brief description of the issue and solutions:
”When calling UnityServices.InitializeAsync() as described in the documentation and when you profile the call it creates the StandardPurchasingModule instance. StandardPurchasingModule has a static dictionary with UDP.Name in it that blocks the calling thread (Main thread) because it uses reflection internally.

Expected behaviour: Calling an initialize method should not block for a considerable amount of time especially if we never target UDP.
This is relatively easy to fix by making this a static method with a switch case in it.”

  1. Resolution Note:

    Deprecated in 5.0.0

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.