Search Issue Tracker
Won't Fix
Votes
41
Found in
2022.3.16f1
2023.2.4f1
2023.3.0b1
Issue ID
UUM-59652
Regression
No
Crash on TransformAccessClearCallback when undoing ModularAvatar > Setup Outfit
Reproduction steps:
1. Open the attached project "ReproProj"
2. Open the “/Assets/scene.unity” Scene
3. Right-click “test“ GameObject (shapell > test)
4. Select ModularAvatar > Setup Outfit
5. Press CTRL + Z
6. Repeat steps 3 - 5
Expected result: Editor does not crash and continues to run
Actual result: Editor crashes
Reproducible with: 2022.3.16f1, 2023.2.4f1, 2023.3.0b1
Could not test with: 2021.3.33f1 (No ModularAvatar option)
Reproducible on: Windows 10 Enterprise 21H2
Not reproducible on: No other environment tested
Note:
- Modular Avatar is a 3rd party plugin
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
- "OnApplicationQuit" is called when "Application.wantsToQuit" returns false
- Console search fails to find log messages when log messages contain <B></B> tags
- ListView fails to display items when the source list is cleared and a single element is added
- UI Toolkit ':hover' state remains active when another panel is drawn over the hovered element and Touch input is used
- Unsupported Orient modes can be selected and throw errors when using Strip VFX
Resolution Note:
The crash in TransformAccessClearCallback comes from TransformAccess data that was saved into Undo being changed without updating the Undo System. This happens during a call to a user function called RebuildLock called after the undo data has been finalised. When attempting to undo, none of the relevant Transforms exist any more and clearing/applying the serialised data regarding those Transforms fails.
Any code where new objects are created but not explicitly saved into the Undo System cannot be considered fully undoable. Additionally the Undo System cannot be expected to recover gracefully when the data it was provided is incomplete or incorrect, it is simply pointing to invalid memory once something changes without it being informed.
In this case the constructor OnewayArmatureLock creates hundreds of unsaved Transforms and then baseBonesAccessor is switched to this list, making the TransformAccessArray data that was saved to the Undo System invalid.
The crash described can be avoided by registering all the 'baseBone' Transforms using Undo.RegisterCreatedObjectUndo(baseBone, "") to ensure that the Transforms referred to in the TransformAccessArray contained in the Undo action still exist.
Alternatively if the _baseBonesAccessor TransformAccessArray is disposed using _baseBonesAccessor.Dispose() before being directly overwritten the memory is cleared correctly and the Undo system is updated accordingly.