UE4-21 UNDO in realtime

You could implement this with a stack of action objects.

  1. You should create an Action class where you need to add three events: Execute, Undo and Redo.
    image

  2. Next, for any action you want to process, create a class inherited from the base Action class and add the necessary data there.

  3. Override events: Execute, Undo and Redo in child class.

  4. Create an array(stack) of Actions objects in another class where you want.
    image

  5. At runtime, add a child class object to the array for each action.

  6. Next, you can move up and down the stack by triggering Undo and Redo events

In the same way, I implemented the history of actions in my runtime editor:

1 Like