Godot Version
Godot Version: 4.2.1
Question
For some reason, client does nothing when try to connect.
The buttons signals are properly working
extends Node3D
@onready var address_entry : LineEdit = $Camera3D/CanvasLayer/PanelContainer/MarginContainer/VBoxContainer/AddressEntry
const PORT = 9999
var Address = "127.0.0.1"
var peer
func ready():
multiplayer.peer_connected.connect(peer_connected)
multiplayer.peer_disconnected.connect(peer_disconnected)
multiplayer.connected_to_server.connect(connected_to_server)
multiplayer.connection_failed.connect(connection_failed)
func _on_host_button_pressed():
peer = ENetMultiplayerPeer.new()
var error = peer.create_server(PORT,16)
if error != OK:
print("Coudn't Host: " + error)
peer.get_host().compress(ENetConnection.COMPRESS_RANGE_CODER)
multiplayer.multiplayer_peer = peer
print(Address)
func _on_join_button_pressed():
peer = ENetMultiplayerPeer.new()
# DEBUG fazer o código de ip customizado
peer.create_client(Address,PORT)
peer.get_host().compress(ENetConnection.COMPRESS_RANGE_CODER)
multiplayer.multiplayer_peer = peer
func peer_connected(id):
print("Player Connected " + str(id))
func peer_disconnected(id):
print("Player Disonnected " + str(id))
func connected_to_server():
print("Connected to Server!")
func connection_failed():
print("Couldn't connect.")