Command History
Command-base history service
In One Line
Time-travel for your actions: Command, undo, redo, perfect!
Package Info
display name
AceLand Kalman Filter
package name
latest version
1.1.1
namespace
git repository
dependencies
Project Settings
Command History
---
Max History
Maximum history to be kept in system.
range: 16 to 512
default: 32
Events
---
New History Events
Enable events on new history added
default: true
Undo History Events
Enable events on history undone
default: true
Redo History Events
Enable events on history redone
default: true
Clear History Events
Enable events on history clear
default: true
History Change Events
Any above event invoked
default: true
API
Overview
Command History is a flexible undo/redo system that helps you track and reverse user actions in your Unity application. Built on the Command pattern, it provides a clean, type-safe way to implement history management for any operation.
Quick Start
create a new command on changing the target value.
excute and add to history
OR add to history only on case excuted once
call Undo or Redo from API
call Clear from API.
Events
Events will be raised on certains situations
INewHistoryEvent
On history is added to system.
Case including Add() and AddAndExecute().
IUndoHistoryEvent
On history is undone.
IRedoHistoryEvent
On history is redone.
IClearHistoryEvent
On history is clear.
IHistoryChangeEvent
On any above cases are invoked.
Please refer to Event Bus page for the details of events.
Example
Common Patterns
Basic Command Creation
Command Management
Best Practices
Keep Commands Small and Focused
Store State, Not References
Use Command Groups for Complex Operations
Catch events for set state of UI components
Pick the perfect time to clear history - for example after data saved
Tips and Tricks
Use
Command.Clone()to create copies of existing commandsCommands are automatically validated before execution
History is cleared when entering play mode
Commands are executed in FIFO (First In, First Out) order
Last updated