Search Issue Tracker
Fixed in 2021.1.X
Fixed in 2019.4.X, 2020.2.X, 2020.3.X
Prefabs are reimporting every time a code change is made
Based on the discussion on this forum thread: https://forum.unity.com/threads/prefabs-are-reimporting-every-time-a-code-change-is-made.939756
I was discovered that when the following conditions aligned, all Prefabs with a [SerializeField] attribute in a Script were reimporting:
1. Create a project
2. Create a Prefab (PrefabA)
3. Create a new Monobehaviour (i.e. ScriptA.cs)
4. Create another Monobehaviour (i.e. ScriptB.cs)
5. Add ScriptA & ScriptB to a prefab.
6. In Script A, add a private variable:
[SerializeField] private ScriptB scriptReference;
7. Add a new Script that contains this (AssemblyStaticInfo.cs):
8. Create a new script (UnrelatedScript.cs)
9. Modify that script, and notice that EVERYTIME UnrelatedScript is modified, PrefabA is reimported.
10. Remove the [SerializeField] from ScriptA
11. Notice the Prefab no longer reimports.
Expected: Unrelated code changes should not reimport prefabs.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- [Search Picker] Undoing selection in unity while the picker is opens doesn't close the picker
- [Android] APP becomes unresponsive and crashes with ANR errors
- Replace no longer replaces when using incremental pipeline
- [LightProbes] Individual light probe gizmos are no longer visible
- [iOS] Canvas does not change when enabled in OnApplicationFocus/OnApplicationPause events