Download

Create a new UWorld in a new SWindow

I want to create a new world with isometric camera view into it. I want then load it into my new SWindow. I create new world and window like so:


        const FText TacViewTitle = LOCTEXT( "TacView", "TacView" );
        TacViewFrame = SNew( SWindow )
            .AutoCenter( EAutoCenter::None )
            .Title( TacViewTitle )
            .IsInitiallyMaximized( false )
            .ScreenPosition( FVector2D( 0, 25 ) )
            .ClientSize( FVector2D( 800, 800 ) )
            .CreateTitleBar( true )
            .SizingRule( ESizingRule::UserSized )
            .SupportsMaximize( false )
            .SupportsMinimize( true )
            .IsTopmostWindow( false )
            .LayoutBorder( FMargin( 10, 5, 10, 10 ) )
            .InitialOpacity( 1.0f )
            .HasCloseButton( true )
            
                SAssignNew( TacViewViewportWidget, STacticalViewport )
            ];

        EObjectFlags NewObjectFlags = RF_NoFlags;
        TacWorld = NewObject<UWorld>( GetTransientPackage(), NAME_None, NewObjectFlags );
        TacWorld->WorldType = EWorldType::Game;
        FWorldContext& WorldContext = GEngine->CreateNewWorldContext( TacWorld->WorldType );
        WorldContext.SetCurrentWorld( TacWorld );
        TacWorld->InitializeNewWorld( UWorld::InitializationValues()
            .AllowAudioPlayback( true )
            .RequiresHitProxies( false )
            .CreatePhysicsScene( true )
            .CreateNavigation( true )
            .CreateAISystem( true )
            .ShouldSimulatePhysics( true )
            .EnableTraceCollision( true )
            .SetTransactional( false )
            .CreateFXSystem( true ) );
        TacWorld->InitializeActorsForPlay( FURL() );

        FSlateApplication::Get().AddWindowAsNativeChild( TacViewFrame.ToSharedRef(), FSlateApplication::Get().GetActiveTopLevelWindow().ToSharedRef(), true );

How can I make a “window” into this newly created world so i can start placing actors in it? I’ve created my derived FCommonViewportClient class and i played around with SViewport but I couldn’t figure out how they all connect and play with each other. hints?