Class UndoBlock
Class that automatically groups a series of object actions together as a single undo-operation
And works in both the editor and player (with player support simply turning off undo-operations)
Mirrors the normal functions you find in the Undo class and collapses them into one operation
when the block is complete
Proper usage of this class is:
using (var undoBlock = new UndoBlock("Desired Undo Message"))
{
undoBlock.yourCodeToUndo()
}
Syntax
public class UndoBlock : IDisposable
Constructors
UndoBlock(String, Boolean)
Declaration
public UndoBlock(string undoLabel, bool testMode = false)
Parameters
Methods
AddComponent<T>(GameObject)
Declaration
public T AddComponent<T>(GameObject gameObject)
where T : Component
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
Returns
Type Parameters
Dispose()
Declaration
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
Boolean |
disposing |
|
RecordObject(Object)
Declaration
public void RecordObject(Object objectToUndo)
Parameters
Type |
Name |
Description |
UnityEngine.Object |
objectToUndo |
|
RegisterCreatedObject(Object)
Declaration
public void RegisterCreatedObject(Object objectToUndo)
Parameters
Type |
Name |
Description |
UnityEngine.Object |
objectToUndo |
|
Declaration
public void SetTransformParent(Transform transform, Transform newParent)
Parameters
Type |
Name |
Description |
Transform |
transform |
|
Transform |
newParent |
|