diff --git a/Runtime/Util/UndoGroup.cs b/Runtime/Util/UndoGroup.cs
index 23e76d7..b3100b7 100644
--- a/Runtime/Util/UndoGroup.cs
+++ b/Runtime/Util/UndoGroup.cs
@@ -21,7 +21,7 @@ namespace VelNet
///
- /// Reset to the last UndoState. This only takes ownership if the IPackState component is also a NetworkComponent
+ /// Reset to the last UndoState and remove the state from history. This only takes ownership if the IPackState component is also a NetworkComponent
///
public void Undo()
{
@@ -43,6 +43,28 @@ namespace VelNet
}
}
+ ///
+ /// Reset to the last UndoState. This only takes ownership if the IPackState component is also a NetworkComponent
+ ///
+ public void Revert()
+ {
+ byte[][] lastStates = undoBuffer.LastOrDefault();
+ if (lastStates != null)
+ {
+ for (int i = 0; i < objects.Count; i++)
+ {
+ objects[i].networkObject.TakeOwnership();
+ objects[i].UnpackState(lastStates[i]);
+ }
+
+ if (debugLog) Debug.Log($"Revert {objects.Count} objects");
+ }
+ else
+ {
+ if (debugLog) Debug.Log($"No more undo to undo");
+ }
+ }
+
public void SaveUndoState()
{
byte[][] states = new byte[objects.Count][];
diff --git a/package.json b/package.json
index ad1b159..8fd0fb7 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "edu.uga.engr.vel.velnet",
"displayName": "VelNet",
- "version": "1.2.2",
+ "version": "1.2.3",
"unity": "2019.1",
"description": "A custom networking library for Unity.",
"keywords": [