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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
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.