diff --git a/Runtime/Util/UndoGroup.cs b/Runtime/Util/UndoGroup.cs index a59d0ba..c57a12b 100644 --- a/Runtime/Util/UndoGroup.cs +++ b/Runtime/Util/UndoGroup.cs @@ -17,6 +17,7 @@ namespace VelNet private readonly List undoBuffer = new List(); public int maxUndoSteps = 50; + public bool debugLog; /// @@ -32,6 +33,11 @@ namespace VelNet objects[i].networkObject.TakeOwnership(); objects[i].UnpackState(lastStates[i]); } + if (debugLog) Debug.Log($"Undo {objects.Count} objects"); + } + else + { + if (debugLog) Debug.Log($"No more undo to undo"); } } @@ -45,10 +51,13 @@ namespace VelNet undoBuffer.Add(states); + if (debugLog) Debug.Log($"Saved undo state"); while (undoBuffer.Count > maxUndoSteps) { undoBuffer.RemoveAt(0); + if (debugLog) Debug.Log($"Reached maximum undo history"); } + } public int UndoHistoryLength() @@ -81,6 +90,11 @@ namespace VelNet t.SaveUndoState(); } + if (EditorApplication.isPlaying && GUILayout.Button("Undo now")) + { + t.Undo(); + } + if (GUILayout.Button("Find all undoable components in children.")) { SyncState[] components = t.GetComponentsInChildren(); diff --git a/package.json b/package.json index 4923be5..be1ae93 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "edu.uga.engr.vel.velnet", "displayName": "VelNet", - "version": "1.2.0", + "version": "1.2.1", "unity": "2019.1", "description": "A custom networking library for Unity.", "keywords": [