- Home /
How to perform Undo from script to restore component data?
I want to set pose to character by muscles, save new transforms data and revert last pose. if manually save and return the transform data without Undo, then the transforms in the prefab are marked as dirty, which i would like to avoid
I try make it like this, but Unity stuck
Undo.IncrementCurrentGroup ();
Undo.SetCurrentGroupName ("Change pose");
var undoGroupIndex = Undo.GetCurrentGroup ();
Undo.RecordObjects (animatorTransforms, "");
Undo.CollapseUndoOperations (undoGroupIndex);
/*Update pose*/
Undo.RevertAllDownToGroup (undoGroupIndex);
Comment