Search Issue Tracker
By Design
Votes
0
Found in
2019.4
2019.4.30f1
2020.3
2021.1
2021.2
2022.1
Issue ID
1377465
Regression
No
AssetDatabase observes Package files when the Package has been removed using PackageManager Client.Remove
How to reproduce:
1. Open the attached project
2. Go to MyMenu/Do Stuff at the top of the Editor
3. Observe the Console
Expected result: "Packages/com.unity.2d.sprite/Editor/AssemblyInfo.cs" is logged to the Console only once, before the Package is removed
Actual result: "Packages/com.unity.2d.sprite/Editor/AssemblyInfo.cs" is logged to the Console two times, once after the Package should have been removed
Reproducible with: 2019.4.32f1, 2020.3.22f1, 2021.1.28f1, 2021.2.1f1, 2022.1.0a14
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Prefab that contains a layout group is marked as changed by the Editor when opened
- Emission animation does not appear when the "Emission Map" parameter is set to black in a Lit material
- Particles are rendered behind other GameObjects in the Scene view when the projection is Isometric
- Addressable asset download size remains non-zero when cached in WebGL Player
- The Camera type is registered as Game type when it is actually a Preview Camera
Resolution Note:
This is by design. The API is behaving correctly. I tested the script and the package was added and removed in the same editor tick. Any code before the end of the tick will not reflect the change. The package manager change is only effective when a full editor tick is completed. Sleeping the main thread (i.e. Thread.Sleep) only makes the current tick wait longer. The script could be altered to add/remove packages through sequential `EditorApplication.update` events.
We know the API is not the most user-friendly. We have plans to improve the API and make it more evident a tick yield is necessary for a package to be effectively added/removed/changed and reported by other API.