How to reproduce:
1. Open the attached “IN-106073” project
2. In the toolbar, navigate to Edit > Project Settings…
3. Select the “Player” tab
4. Find “Scripting Backend” and make sure it is set to “IL2CPP”
5. In the toolbar, navigate to File > Build Profiles
6. Make sure “Windows” platform is selected and “Development Build” is toggled on
7. Build and run the project
8. Wait for the Player to start
9. In the Editor's toolbar, navigate to Window > Analysis > Memory Profiler
10. In the Memory Profiler window, control bar, change the target from the Editor to the Player
11. Capture a snapshot
12. Select the newly created snapshot
13. Select the Unity Objects tab
14. In the search bar, enter “VisualTreeAsset”
15. Expand the “ScriptableObject” and “UnityEngine.UIElements.VisualTreeAsset” items
16. Observe the Allocated Size of the three elements under “UnityEngine.UIElements.VisualTreeAsset”
Expected result: All elements have the same size (~500 B)
Actual result: One of the elements has inflated size (~136 KB)
Reproducible with: 2021.3.53f1, 2022.1.0a8, 2022.3.64f1, 6000.0.52f1, 6000.1.9f1, 6000.2.0b8, 6000.3.0a1
Couldn’t test with: 2022.1.0a1, 2022.1.0a7 (Couldn’t connect Player to the Memory Profiler)
Reproducible on: Windows 11
Not reproducible on: No other environments tested
Note: Does not reproduce when “Scripting Backend” is set to “Mono”