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

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.


Events

Events will be raised on certains situations

Event
Description

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.


Example


Common Patterns

Basic Command Creation

Command Management


Best Practices

  1. Keep Commands Small and Focused

  2. Store State, Not References

  3. Use Command Groups for Complex Operations

  4. Catch events for set state of UI components

  5. Pick the perfect time to clear history - for example after data saved


Tips and Tricks

  • Use Command.Clone() to create copies of existing commands

  • Commands are automatically validated before execution

  • History is cleared when entering play mode

  • Commands are executed in FIFO (First In, First Out) order


Last updated