Check if level exists

Hello there,

I wanted to implement a system where each level is named Story_1, Story_2, etc. so that after each level I can travel to the next one with ease. Now this works but after the last level, UE4 obviously tells me that the next level is an invalid url, since it doesn’t exist. Now I would like to check if the next level exists, so I can travel to the main menu in case the story mode is over.

Thanks for any help!

I assume you currently using something like “get current level name” and add 1 to it.
You could do this and the check in the game instance (is globally accessible that can store any data you want to be carried between levels).
Where ever you currently have the logic to open the next level you could move it to the game instance and create there a custom event which checks if the current map the last map is. (Number in the branch check)


Use this node Does Asset Exist | Unreal Engine Documentation
to check if a file exists. the path should be /game/levels/levelname.uasset (or something similar)

Otherwise, there’s no “Does map exist” node AFAIK.