How to get EditorUndoRedoManager from an EditorScript (not an EditorPlugin)

Godot Version

4.3.stable

Question

It seems like it’s impossible to get the EditorUndoRedoManager and add undo redo’s to the scene history with an editor script. Is that correct?

EditorUndoRedoManager is intended to be used by Godot editor plugins. You can obtain it using EditorPlugin.get_undo_redo. For non-editor uses or plugins that don’t need to integrate with the editor’s undo history, use UndoRedo instead.

An EditorScript also runs in the editor (through _run()) and is much easier to setup, but somehow can’t access that same UndoRedo.

Have you tried,

var urm = EditorPlugin.get_undo_redo()

Or

var urm = EditorPlugin.new().get_undo_redo()

Ahhh yeah, big brain solution! The latter works :slight_smile: Thank you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.