In-game c++ change in actor data doesn't refresh

I’ve got a blueprint function that runs whenever I press a button in-game.

The function modifies a tilemap’s data

PROBLEM: the changes are not applied till AFTER I stop and restart the application.

Code of blueprint function:

UE_LOG(LogTemp, Warning, TEXT("BeginGenerateWorld"));

	TObjectIterator<AActor> Itr;
	UWorld* TheWorld = Itr->();
	
	UPaperTileSet * ts = LoadObjFromPath<UPaperTileSet>(TEXT("/Game/TilemapProject/Tile/oryx_world_bg0.oryx_world_bg0"));

// That's how I get the tilemap actor
auto actorItr = TActorIterator<APaperTileMapActor>(TheWorld);
APaperTileMapActor * tmactor = *actorItr;
auto tm = tmactor->GetRenderComponent()->TileMap;
auto tmlayer = tm->TileLayers[0];
for (int i = 0; i < tmlayer->LayerHeight; ++i)
    for (int j = 0; j < tmlayer->LayerWidth; ++j)
    {
        FPaperTileInfo pti;
        pti.TileSet = ts;
        pti.PackedTileIndex = FMath::RandRange(0, pti.TileSet->GetTileCount() - 1);
        tmlayer->SetCell(j, i, pti);
    }
	
	UE_LOG(LogTemp, Warning, TEXT("EndGenerateWorld"));

If you have behavior like that it means there need to be update function somewhere, maybe this?

https://docs.unrealengine.com/latest/INT/API/Plugins/Paper2D/UPaperTileMap/UpdateBodySetup/index.html

Nope, it’s protected. I was afraid that I’m doing sth conceptually wrong, e.g. modifying the asset archetype rather then instantiated asset in the game, so when I restart it uses the modified asset archetype to instantiate the asset. That’s the behavior it has anyway.

Ok, apparently after I change the tilemap data, I need to manually send an event that something changed. Apparently, the event doesn’t matter: I can pass null. I add the below after the changes

FPropertyChangedEvent evt(nullptr);
tmlayer->PostEditChangeProperty(evt);

Ok, in the spirit of what you said, but a bit different - I had to do a posteditchangeproperty. I put it as an answer, so that if it sucks, people can explain why