Download

Moving levels doesn't save!

Can sub-levels not move in the Z axis or something?

It takes affect when I do it, but the changes don’t save with this chunk of code:



UWorld* World = GEditor->GetEditorWorldContext().World();
    UWorldComposition::FTilesList& Tiles = World->WorldComposition->GetTilesList();
    for (FWorldCompositionTile& Tile : Tiles)
    {
        UPackage* LevelPackage = Cast<UPackage>(StaticFindObjectFast(UPackage::StaticClass(), NULL, Tile.PackageName));
        if (LevelPackage)
        {
            // Find the world object
            UWorld* World = UWorld::FindWorldInPackage(LevelPackage);
            if (World)
            {
                ULevel* Level = World->PersistentLevel;
                Level->ApplyWorldOffset(FVector(0, 0, -198400.0f), false);
                for (AActor* Actor : Level->Actors)
                    if (Actor != nullptr)
                        GEditor->BroadcastOnActorMoved(Actor);

                ULandscapeInfo::RecreateLandscapeInfo(World, false);
                Level->MarkPackageDirty();
            }
        }
    }