Hi friends—I’m doing a widget tutorial, and ran into an issue where the Game Mode Override retains when you go into each level file.
I’ve created a “Main Menu” level where I’ve only added my menu widget to the viewport, and that’s all I want to see, so I’ve disabled Default Pawn Class and HUD Class to get rid of everything else that was in my “Office Level” file. I set them to none, and the Default Pawn Class and HUD Class are gone. Perfect.
So now I open up my “Office Level” file, and the Default Pawn Class and HUD Class are still set to none, so all of my Blueprints for that level don’t work.
I manually set them back to SpectatorPawn and FirstPersonHUD (respectively), and get them back.
But now I open up my Main Menu level, and the GameMode Override in the World Settings are now set to SpectatorPawn and FirstPersonHUD.
Meaning, the Game Mode settings are carrying over / retaining from previous level to current level whenever I open up a new level file, and I’m curious how I can get them so they’re exclusive per level file.
Any help would be much appreciated; thanks!
Hi!
I think I can help.
You need to make a new game mode blueprint. I think you’re attempting to override the same game mode. If you haven’t created a new game mode, I suggest three. For example: MyGameMode, MainMenuMode and OfficeLevelMode.
MyGameMode would be the project game mode and would apply to any level you don’t assign a world override game mode.
By default, your project uses the GameModeBase, which is what all game modes derive from. That’s likely what you’ve been modifying and what has carried your changes between levels.
Click on “Blueprints” in the tool bar to select your newly created game mode.
Also by default, there is no world override assigned and all new levels will use the project game mode.
Use the world override to assign game modes on a per-level basis:
MainMenuMode would be assigned in the World Override for your main menu, and OfficeLevelMode would be assigned to your office level’s World Override - as well as other levels that behave similarly from a game mode perspective.
Once you create the game mode blueprints, you edit the settings by using the same blueprints menu, opening the game mode blueprints, or by using the world settings panel.
Check out the [Docs on GameModes][3] to learn more about game modes!
Please mark this answer as accepted if it has been helpful or comment below if you have more questions!
Happy developing,
Reishi
3 Likes
Hey!
what you are doing is you are using a single game mode for multiple levels, And expect to changeing a values in one level wouldn’t affect other levels.
game mode is the same class, sharing between different levels, so when you make change into game mode, it will affect all the levels that are using in it.
Solution :
- use different game modes for different levels.
- if you want to use the same game mode for many levels and want to apply different settings depending on your level than what you can do is on event begin play of level blueprint set different values depending on your level, so whenever you load a new level, new values will be changed based on your level.