我正在尝试测试我的 godot 多人游戏,我需要从一台计算机上执行此操作,但问题是当我打开两个 godot 应用程序运行它时,它不起作用(显然)我收到以下错误:(来自服务器的错误joiner)
E 0:00:02:0306 _send_sync: Condition "!sync || !sync->get_replication_config_ptr() || !_has_authority(sync)" is true. Continuing. <C++ Source> modules/multiplayer/scene_replication_interface.cpp:812 @ _send_sync()
(来自服务器托管者的错误)E 0:00:07:0261 _send_sync: Condition "!sync || !sync->get_replication_config_ptr() || !_has_authority(sync)" is true. Continuing. <C++ Source> modules/multiplayer/scene_replication_interface.cpp:812 @ _send_sync()
这两个错误都有增量变化,其中是_send_delta
,而我所能提供的只是我的代码:
extends Node2D
var peer = ENetMultiplayerPeer.new()
@export var player_scene: PackedScene
@onready var menu = $CanvasLayer
func _on_host_pressed():
menu.hide()
peer.create_server(8120)
multiplayer.multiplayer_peer = peer
multiplayer.peer_connected.connect(add_player)
add_player(multiplayer.get_unique_id())
func add_player(id):
var player = player_scene.instantiate()
player.name = str(id)
add_child(player)
func _on_join_pressed():
menu.hide()
peer.create_client("localhost",8120)
multiplayer.multiplayer_peer = peer
已修复,我没有使用调试功能。