# How to use OpenLevel() with multiple player starts?

**URL:** <https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828>\
**Category:** Community & Industry Discussion\
**Tags:** openlevel, unreal-engine, playerstart, question\
**Created:** [July 8, 2020, 3:58am UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828 "2020-07-08T03:58:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/samathan/32/1058905_2.png) [@Samathan](https://forums.unrealengine.com/u/Samathan)\
**Post date:** [July 8, 2020, 3:58am UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/1 "2020-07-08T03:58:07Z")

</div>

I have multiple player starts in a level and want the destination to be able to change. How can I use OpenLevel() to spawn the player at a specific one of these player starts?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 8, 2020, 6:02am UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/2 "2020-07-08T06:02:56Z")

</div>

Does that change depends on the previous level? If so, why messing aroung with OpenLevel when you can, for example, use GameInstance.

---

<div class="post-metadata">

**Author:** ![plato.manchi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/plato.manchi/32/881681_2.png) [@plato.manchi](https://forums.unrealengine.com/u/plato.manchi)\
**Post date:** [July 8, 2020, 10:43am UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/3 "2020-07-08T10:43:49Z")

</div>

In game mode there is a function called FindPlayerStart which is a BlueprintNativeEvent. Which means you can override the function:

```
AActor* FindPlayerStart_Implementation(AController* Player, const FString& IncomingName);

```

Override this function in your gamemode for the level and iterate through your playerstarts and return the one that is suitable.

---

<div class="post-metadata">

**Author:** ![Samathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/samathan/32/1058905_2.png) [@Samathan](https://forums.unrealengine.com/u/Samathan)\
**Post date:** [July 8, 2020, 5:03pm UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/4 "2020-07-08T17:03:16Z")

</div>

I know how to find the correct player start. How do I use that to have the player spawn there with OpenLevel()?

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 8, 2020, 5:19pm UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/5 "2020-07-08T17:19:01Z")

</div>

Pass the identification of the player start you want in the option box.

---

<div class="post-metadata">

**Author:** ![Samathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/samathan/32/1058905_2.png) [@Samathan](https://forums.unrealengine.com/u/Samathan)\
**Post date:** [July 8, 2020, 5:30pm UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/6 "2020-07-08T17:30:35Z")

</div>

How do you use the option parameter? I couldn’t find a single piece of documentation on it anywhere. Not even Unreal’s documentation explains how to use it.

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 8, 2020, 5:55pm UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/7 "2020-07-08T17:55:58Z")

</div>

“Options String”. Now it’s up to you to parse it.

Example. If

 ![306564-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/d/4/8d42635567ebfa0bbdc9a49b5648d7ffbe9d6849.jpeg)

Then “Options String” will have the string "qwe asd askljdakjskajkljskdljfskldjf ".

---

<div class="post-metadata">

**Author:** ![Samathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/samathan/32/1058905_2.png) [@Samathan](https://forums.unrealengine.com/u/Samathan)\
**Post date:** [July 8, 2020, 5:58pm UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/8 "2020-07-08T17:58:12Z")

</div>

But I’m using C++

---

<div class="post-metadata">

**Author:** ![Samathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/samathan/32/1058905_2.png) [@Samathan](https://forums.unrealengine.com/u/Samathan)\
**Post date:** [July 8, 2020, 5:58pm UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/9 "2020-07-08T17:58:39Z")

</div>

It depends on an instance of a user-created actor

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 8, 2020, 6:21pm UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/10 "2020-07-08T18:21:38Z")

</div>

C’mon dude. It’s all there.

To open a level:

```
UGameplayStatics::OpenLevel(this, FName("/Game/tests/map1"), false, "XXX");

```

The options string is in:

```
OptionsString

```

in the game mode.

For example, if in the game mode you write this up:

```
void AFPCPPGameMode::BeginPlay()
{
	Super::BeginPlay();
	UE_LOG(LogTemp, Warning, TEXT("Options > % s"), *OptionsString);
}

```

It will log “Options \> XXX”.

---

<div class="post-metadata">

**Author:** ![plato.manchi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/plato.manchi/32/881681_2.png) [@plato.manchi](https://forums.unrealengine.com/u/plato.manchi)\
**Post date:** [July 9, 2020, 2:48pm UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/11 "2020-07-09T14:48:29Z")

</div>

In this function you get the PlayerController, so write your code to find the player start here and return the player start. Player with that controller will automatically spawn at that player start that is returned in this function.  
You dont have to do anything extra for player to spawn at that player start other than returning the player start in this function. Spawning player at that start location is handled by UE4 as long as you return the correct player start.

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 11, 2020, 2:42pm UTC](https://forums.unrealengine.com/t/how-to-use-openlevel-with-multiple-player-starts/467828/12 "2020-07-11T14:42:49Z")

</div>

Can you explain what the problem with my solution is? You wanted to specify which player start you wanted in the Open Level. So, I gave it to you.

All you have to do is set the “Player Start Tag” tags in all Player Start actor (which one of them should match with the string you going to pass in the options) and override ChoosePlayerStart function in the gamemode.
