Search Issue Tracker
By Design
Votes
0
Found in
2019.4
2020.3
2021.2
2021.2.0f1c1
2022.1
Issue ID
1378131
Regression
No
Prefab modifications aren't saved when "Auto Save" is enabled
Reproduction steps:
1. Open the user's attached "EditGridTest.zip" project
2. Open the "SampleScene" Scene
3. Open the "Test" Prefab Asset
4. Check the "Auto Save" tick-box at the top of the Scene view
5. Click the "Edit Grid" button in the Inspector window inside of "TestGrid (Script)" Component
6. Left-click on the Scene view window to draw line blocks
7. Exit the "Test" Prefab Asset
8. Observe the Scene view window
Expected result: All drawn blocs are saved
Actual result: The minority of drawn blocks are saved
Reproducible with: 2019.4.33f1, 2020.3.24f1, 2021.2.5f1, 2022.1.0a16
Notes:
- Unchecking the "Auto Save" tick-box and saving the prefab manually doesn't reproduce the issue
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
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
Resolution Note:
In order to support drag-painting blocks you need to set the GUIUtility.hotcontrol property while painting (See https://docs.unity3d.com/ScriptReference/GUIUtility-hotControl.html).
The Prefab Mode checks if the hotcontrol is set and delays autosaving until it is released again.
Example for your editor script:
private void OnSceneGUI()
{
int controlID = GUIUtility.GetControlID(FocusType.Passive);
if (GUIUtility.hotControl == 0 && Event.current.type == EventType.MouseDown && Event.current.button == 0)
{
GUIUtility.hotControl = controlID;
Debug.Log("Grab hotcontrol");
}
if (GUIUtility.hotControl == controlID && Event.current.type == EventType.MouseUp && Event.current.button == 0)
{
GUIUtility.hotControl = 0;
Debug.Log("Release hotcontrol");
}
.....