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
- Some UXML Template Asset foldouts appear enabled when all fields inside are disabled
- URP Terrain Demo crash on burst_signal_handler after Generating lighting
- Project window button icons are poorly visible and their shades differ in Light theme
- Automatic LOD fails and SRP Batcher incompatibility occurs when using spline-based quad-topology meshes
- Editor crashes on D3D12GetInterface when repeatedly enabling and disabling 256 text components
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");
}
.....