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
- Search field in UI Builder's Library has no character limit
- Changing the value in UI Builder by dragging increases it by a few thousand points when reaching the borders of the screen
- ARM64 architecture DLL incorrectly copied instead of x64 when building for Windows x64
- Crash on TypeTreeIterator::GetNode when opening a specific folder
- Crash on WriteSerializedAssetsV2 when (re)entering the Play Mode in a specific project when IEnumerator Start() is used
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.