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
- “Assertion failed on expression” errors thrown when undoing Nodes creation with keyboard shortcut
- Crash on various stack traces when using Texture2D.CreateExternalTexture() while rendering
- Clicking on section text in Node Library > Context folder throws NullReferenceException errors
- Node Library window sections text in Context folder are not visible when Editor is set to Light Theme
- "Scene Depth Difference" Node has an input Port which is called Position WS, directly referring to the World Space Position, when only the View Space Position can reflect if the object's depth is below or above the Plane
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.