Replicated Sublevel Instances Quickstart

How did we do?

This quickstart guide will walk you through installing and using Replicated Sublevel Instances in your Unreal Engine 4 game.

Install Replicated Sublevel Instances

If you haven't already done so, purchase Replicated Sublevel Instances on the Unreal Engine Marketplace.

Once you've purchased Replicated Sublevel Instances, install it to your machine through the Epic Games Launcher:

Open or create a new Unreal Engine project

Open or create the Unreal Engine project that you want to use Replicated Sublevel Instances with. This quickstart will assume you're starting from a blank project, but the instructions should be applicable to existing projects as well.

Enable Replicated Sublevel Instances

Before you can start using Replicated Sublevel Instances, you'll need to enable the plugin in your project. Open the plugin manager from the Settings menu:

Locate "ReplicatedSublevelInstances", and check the Enabled checkbox:

When prompted to restart the editor, click "Restart Now":

Create two new levels

Once the editor has restarted, create two new levels in your Content Browser, one named "MyMainLevel" and one named "MySublevel". Then, open the "MySublevel" level in the editor.

Update the sublevel

Update the sublevel to contain a Cube actor and a Point light, as shown in the following image:

Create a new blueprint

Now we need to create the blueprint that will spawn the sublevel instance dynamically. Create a new Actor blueprint with the name "MapManager":

Add the Sublevel component to the blueprint

In the blueprint editor for "MapManager", click Add Component and search for "Sublevel". Then click on "Sublevel" to add the component:

Set up the component to load the level on BeginPlay

Update the "MapManager" blueprint to set the path of the sublevel component and activate it when the "MapManager"'s BeginPlay event occurs:

Enable the MapManager actor to replicate

In order for the MapManager actor to replicate to clients in a multiplayer game, you must enable "Replicates" on the actor. In addition, you must mark the actor as "Always Relevant", since we want the sublevel to propagate to all clients connected to the game.

Enable the Sublevel component to replicate

In order for the Sublevel component to replicate as part of the MapManager actor, you must enable "Component Replicates". Select "Sublevel" in the "Components" tab, then check "Component Replicates" under the "Details" tab:

Add the MapManager to MyMainLevel

Open up MyMainLevel, and using the "Modes" pane, search for "MapManager" and drag it into the world. You should see the MapManager in the world like so:

Test it in single player

You can now click Play in the Unreal Engine toolbar to test that the sublevel spawns in correctly. You should see the cube that was added to "MySublevel" appear in the game:

Test it in multiplayer

Once it's working in single player, you can try it out in multiplayer. Under the Play toolbar button, increase the number of players to 2 as shown in the following screenshot:

Then click the "Play" button in the toolbar. You should see a second window open (the second client) and if you move the players around, you should be able to notice that they can both see the cube in the sublevel, and each other: