# Replicated Alternative to LoadLevelInstance?

**URL:** <https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102>\
**Category:** C++\
**Tags:** unreal-engine, UE5-0, Multiplayer, CPP, question\
**Created:** [October 31, 2022, 7:23pm UTC](https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102 "2022-10-31T19:23:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_c2dfcd1a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c2dfcd1a](https://forums.unrealengine.com/u/anonymous_user_c2dfcd1a)\
**Post date:** [October 31, 2022, 7:23pm UTC](https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102/1 "2022-10-31T19:23:35Z")

</div>

I have a working level generation system that adds UWorld objects into the current level using the ULevelStreamingDynamic::LoadLevelInstance method, which takes a UWorld and a position and spawns the UWorld at the position. However, this method is not replicated- if the server calls it, it doesn’t exist on clients automatically. Unlike, for example, the SpawnActor method, which does behave this way.

Is there an equivalent method for spawning a UWorld/Level object into the current level which I can call on the server to have it be replicated onto all clients?

---

<div class="post-metadata">

**Author:** ![Humanasset](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/humanasset/32/251551_2.png) [@Humanasset](https://forums.unrealengine.com/u/Humanasset)\
**Post date:** [November 1, 2022, 7:06am UTC](https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102/2 "2022-11-01T07:06:31Z")

</div>

Perhaps try doing it from the level since it’s loaded on all clients and the server?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c2dfcd1a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c2dfcd1a](https://forums.unrealengine.com/u/anonymous_user_c2dfcd1a)\
**Post date:** [November 1, 2022, 1:58pm UTC](https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102/3 "2022-11-01T13:58:46Z")

</div>

How do you mean? Doing it with what method?

---

<div class="post-metadata">

**Author:** ![Humanasset](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/humanasset/32/251551_2.png) [@Humanasset](https://forums.unrealengine.com/u/Humanasset)\
**Post date:** [November 1, 2022, 7:37pm UTC](https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102/4 "2022-11-01T19:37:39Z")

</div>

Well, with what I’ve been working with, I’m doing mine straight from the level blueprint. It’s not C++ like in your case, but it’s pretty effective and straight forward…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c2dfcd1a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c2dfcd1a](https://forums.unrealengine.com/u/anonymous_user_c2dfcd1a)\
**Post date:** [November 1, 2022, 7:54pm UTC](https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102/5 "2022-11-01T19:54:02Z")

</div>

Ah, I see. So you’re using the LoadLevelInstance node in the level blueprint. Is your level randomized? Are you needing to make sure the seed is the same between client and server?

---

<div class="post-metadata">

**Author:** ![Humanasset](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/humanasset/32/251551_2.png) [@Humanasset](https://forums.unrealengine.com/u/Humanasset)\
**Post date:** [November 1, 2022, 8:15pm UTC](https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102/6 "2022-11-01T20:15:25Z")

</div>

Yes, I use the node in the level blueprint and I have cases for random levels… For level randomization, I use a persistent game state across the entire game that directs the game into any particular level or random level.

From that specific level, I can load any sublevels and such into that particular level through the level blueprint and talk directly to the game state and set a boolean on the game state from the level to tell it where the game is and execute logic across all clients consistently and also to the map’s respective game mode.

I personally have not found any other way to do this outside of the level blueprint itself. I only use this for loading sublevels and things of that nature. I let the game mode do all the spawning of actors.

---

<div class="post-metadata">

**Author:** ![zos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zos](https://forums.unrealengine.com/u/zos)\
**Post date:** [November 2, 2022, 8:40am UTC](https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102/7 "2022-11-02T08:40:58Z")

</div>

I’m not sure if there is a better way but I think you could try adding a reliable multicast RPC on your game state, and then call it from the game mode. Then the function will be executed on all the client/server worlds. In the function implementation you can then call LoadLevelInstance. This will cause the sublevel to be loaded on each client/server.

I’m not sure how it works if sublevels contain replicated actors. It might do the right thing and connect them up, I’m not 100% sure.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c2dfcd1a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c2dfcd1a](https://forums.unrealengine.com/u/anonymous_user_c2dfcd1a)\
**Post date:** [November 2, 2022, 7:09pm UTC](https://forums.unrealengine.com/t/replicated-alternative-to-loadlevelinstance/681102/8 "2022-11-02T19:09:32Z")

</div>

I’ve discovered what seems to be the solution in a post on another thread, from user

> [@Dynamic level streaming with multiplayer support](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/35):
>
> What I have found, If you are using the LoadLevelInstanceBySoftObjectPtr (c++), make sure the NAME attribute is exactly the same for clients and the Server. Example: LevelName = FName(TEXT(“MyLevelStreamed”)); ULevelStreamingDynamic::LoadLevelInstanceBySoftObjectPtr(this, LevelToStream, RootComponent-\>GetComponentLocation(), RootComponent-\>GetComponentRotation(), bLevelInstanceSuccess, LevelName.ToString()); After found this, I finally understood the logic behind. If you have an item inside …

Essentially, if you override the package names of the levels to match and spawn the same levels on client and server, the objects within that level are replicated. I don’t think there is any way to have just the server do the spawning and have it be replicated on the clients, like with SpawnActor, but this method is close enough for me.
