fix: switch_game_mode condition now first checks if a game mode is already active

stripped
Sara 2024-05-31 21:25:58 +02:00
parent 1672dbd5f8
commit 4e231f5be3
1 changed files with 1 additions and 1 deletions

View File

@ -119,7 +119,7 @@ Level3D *GameRoot3D::load_level_at(gd::Ref<gd::PackedScene> level, gd::Transform
// store and add to tree at desired transform
// if this is the first level containing a game mode currently active use it's gamemode as a prototype
gd::Ref<gd::PackedScene> game_mode_prototype{instance->get_game_mode_prototype()};
bool const switch_game_mode{this->game_mode->get_scene_file_path() != game_mode_prototype->get_path()};
bool const switch_game_mode{!this->game_mode || this->game_mode->get_scene_file_path() != game_mode_prototype->get_path()};
if(switch_game_mode) {
this->set_game_mode(instance->get_game_mode_prototype());
}