Unreal Engine 4 Tutorial: How to reload the current level
Tuesday, January 19, 2016
programming
ue4
Intro
In this Unreal Engine 4 tutorial I will show you how to reload the current level using Blueprints.
One of the first things I wanted to do with Unreal Engine 4 (UE4) was to reload the current level or map that I was working on. I looked all over the place and eventually found the answer. However, I felt that it should have been easier to find. I hope this post saves someone some time.
The Blueprint
As you can see it's very simple. Get current level name, convert return value from string to name value and pass it to the open level function.
The OnClicked (Button_123) event is bounded to an UI button but you can execute the same logic from just about anywhere.
C++ Version
For those working in C++ here is how I did it when I was working in C++.
UGameplayStatics::OpenLevel(this, FName(*GetWorld()->GetName()), false);
Console Command
This method is not recommended but you can also execute the command RestartLevel
under the console or using the Execute Console Command
blueprint node.
Recommended Reading
For those that like to learn from a book here is one I recommend (Amazon link):