Godot Version
v4.4.1.stable.steam [49a5bc7b6]
Question
After export multiplayer level switching stopped working, game just crushes but in Editor all works perfectly fine both with Steam and local simulation. I tried to use ResourcePreloader for levels(they not really big) but it did not helped.
I use SteamMultiplayerPeer and GodotSteam extensions.
Level switching done with use of MultiplayerSpawner. Switching done when 2 players enter area at the end of level.
func _on_body_entered(body: Node3D) -> void:
if body is Player:
Player_counter += 1
Player_list.append(body)
if Player_counter >= 2 or (Global.Debug_mode == true and Player_counter >=1):
for host in Player_list:
if host.name =="1":
$"../..".on_level_complete()
After it calls parent node(always same path)
func on_level_complete():
if multiplayer.get_unique_id() != 1:
Global.Shooting_time = false
return
var first_step = get_parent()#Go to level in main_menu
var second_step = first_step.get_parent()#Go to root of main_menu
second_step.next_level(load(Next_level))#Next_level is PackedScene that assigned in editor with @export
self.queue_free()
And main_menu hendels level switching
func next_level(data):
$Levels.add_child(data.instantiate())
Again in Editor all hendels without any break downs but after export works 0% of the times.
Also I use a looby scene that always loads before any other level and form it players spawn to real level. It works literally the same way but is able to switch level to chosen from main menu somehow…