UKismetSystemLibrary::BeginTransaction
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticBlueprintCallable
Description
Begins a new undo transaction, defined as all actions that take place when the user selects 'Undo' once. Editor-only.
Caveats & Gotchas
- • If a transaction is already in progress, this increments its action counter instead of starting a new one — always pair each BeginTransaction with a matching EndTransaction or CancelTransaction.
- • You must call TransactObject for each object you're about to modify so it's captured in the undo buffer; BeginTransaction alone doesn't record anything.
- • Only available in the editor — this has no effect (and no undo history) in packaged games.
- • Returns -1 on failure, and a value greater than 0 if a transaction was already active; only rely on the return value to detect nesting, not for control flow.
Signature
static int32 BeginTransaction(const FString& Context, FText Description, UObject* PrimaryObject) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Context | FString | The context for the undo session, typically the tool/editor that caused the operation. | — |
| Description | FText | The description shown next to the Undo item in the Edit menu. | — |
| PrimaryObject | UObject* | The primary object the undo session operates on. Can be null, and usually is. | — |
Return Type
int32 Example
Wrap a scripted edit in an undoable transaction C++
UKismetSystemLibrary::BeginTransaction(TEXT("MyEditorTool"), FText::FromString(TEXT("Adjust Health Values")), nullptr);
UKismetSystemLibrary::TransactObject(TargetActor);
// ... modify TargetActor ...
UKismetSystemLibrary::EndTransaction(); See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?