Skip to content

Running your own code after a sync

The two editor-module delegates that fire when a sync and its generation finish — for validation, custom imports, or extra generation of your own.

All documentation — Extending
On this page

A sync is two things in sequence: the sync service drives the sync tool and turns what it wrote into the payload asset; the asset generator then turns the payload into the stores, the indexes, the tags and — when it is on — the typed C++. Each announces its end on a multicast delegate, on the game thread, and both are reachable from an editor module of your own.

Reaching them

#include "TaleShardEditorModule.h"
#include "TaleShardSyncService.h"
#include "TaleShardAssetGenerator.h"
void FMyGameEditorModule::StartupModule()
{
FTaleShardEditorModule* TaleShard = FTaleShardEditorModule::Get();
if (!TaleShard)
{
return;
}
SyncHandle = TaleShard->GetSyncService()->OnSyncFinished().AddRaw(this, &FMyGameEditorModule::HandleSyncFinished);
GenerationHandle = TaleShard->GetAssetGenerator()->OnGenerationFinished().AddRaw(this, &FMyGameEditorModule::HandleGenerationFinished);
}

Remove the handles in ShutdownModule; the plugin’s module may outlive yours.

What each one tells you

On Sync Finished — the sync tool ran, or was refused, or was cancelled. The result carries:

FieldMeaning
Successthe run ended without an error
Up To Datenothing changed since the last sync
Full Syncthe run was a full sync rather than a delta
Cancelledthe user stopped it
Error Messagewhy it failed, or empty
Diagnosticseverything the run reported, with codes

The payload asset has been replaced by then — and only by a payload that parsed; a run that fails writes nothing half-way.

On Generation Finished — the assets are written, or the generation was skipped or refused:

FieldMeaning
Success, Skipped, Skip Reason, Error Messagewhat happened
Diagnosticseverything the generation reported. A generation with any error is a failed generation
Assets Written, Assets Deleted, Tags Written, Redirects Written, Tag Ini Changedwhat it did to your project

The generator listens to the sync service’s own delegate and runs after every successful sync, so this is the one to bind if your code reads the generated assets: by the time it fires, the indexes and stores are on disk and registered.

What to do there

  • Validate. Walk the entity index or the payload and refuse your own rules — a character with no portrait, a board with no start — and print the finding with the sync’s own diagnostics.
  • Import. Build assets of your own from the generated ones: a data table your systems read, a lookup you precompute.
  • Generate. Emit source or assets of your own from the same payload. Write into a folder you own; the plugin sweeps only what its own manifest recorded, and never yours.
Written for
Advanced integrators
Last updated