x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Split Screen Viewport Support in UMG

I made a HUD using UMG, but when I enter split screen mode only one HUD is drawn across the whole screen, rather than in each split screen. I'm adding the HUD to the Viewport in the PlayerController class. Is there a way to implement a split screen-compatible HUD using UMG?

Product Version: Not Selected
Tags:
more ▼

asked Aug 27 '14 at 10:24 PM in Using UE4

avatar image

kylethehuman
11 2 3 5

avatar image Eduard Gotwig Dec 14 '14 at 05:10 PM

As of Unreal Engine 4.6, UMG still does NOT support multiple player controllers / splitscreen viewports, as far as I'm aware. I'm unable to implement it into my game. I would like to spread awareness, so developers work on this!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

That is not directly supported yet, as far as I know. I have implemented a workaround in C++ that basically includes the following steps:

Add blueprint library functions to register and unregister UMG UserWidgets to your project. Basically a single widget or a list of widgets per player. Whenever you add your UMG HUD to the viewport, also register it. Whenever you remove your UMG HUD, unregister it. You need to keep track of those widgets yourself since there is no way to get hold of them later in C++ - you only get references to the underlying Slate widgets.

Now subclass UGameViewportClient and override LayoutPlayers() and add code similar to what I posted below. This will update the anchors of the registered widgets to match the current splitscreen layout. I guess you need a Border widget or another container widget at the top of your UMG HUD for this to work since it will dynamically be resized and you want the rest of your HUD to stay within that container.

Marc

 Super::LayoutPlayers();
 
     const TArray<ULocalPlayer*>& PlayerList = GEngine->GetGamePlayers( this );
 
     for( ULocalPlayer* localPlayer : PlayerList )
     {
         UUserWidget* userWidget = UGlobals::Get().GetSplitscreenWidget( localPlayer->ControllerId );
 
         if( userWidget != nullptr )
         {
             FVector2D viewportSize;
 
             localPlayer->ViewportClient->GetViewportSize( viewportSize );
 
             userWidget->SetAnchorsInViewport( FAnchors( localPlayer->Origin.X, localPlayer->Origin.Y, localPlayer->Origin.X + localPlayer->Size.X, localPlayer->Origin.Y + localPlayer->Size.Y ) );
         }
     }
more ▼

answered Oct 23 '14 at 03:36 PM

avatar image

mkamradt
294 15 136 34

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question