Closed MartSchilt closed 11 months ago
ENetMultiplayerPeer
doesn't have functions HasPeers()
or GetPeers()
or is it just me?
https://docs.godotengine.org/en/stable/classes/class_enetmultiplayerpeer.html
MultiplayerAPI
has get_peers
and has_multiplayer_peer
, no has_peers
though
Please provide basic C# code so I can reproduce it
Please provide a minimal reproduction project:
.godot
folder in the archive (but keep project.godot
).And please make sure it's specific to C#
This is because there's always a default OfflineMultiplayerPeer
, see here
But why doesn't it then show up in the list of peers from GetPeers?
Also the documentation states that "It mimics the behavior of a server with no peers connected" meaning that there are no peers, so I would expect HasMultiplayerPeers to return false
It isn't has_multiplayer_peers
it's has_multiplayer_peer
, it isn't about connected peers, but the peer on your end:
Returns true if there is a
multiplayer_peer
set.
It isn't about any peers connected
Well if that is the desired functionality, I will close this issue
Godot version
4.1.3.stable
System information
Godot v4.1.3.stable.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 SUPER (NVIDIA; 31.0.15.3699) - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)
Issue description
Using C# with Godot 4.1.3 I get the following: I setup a peer-to-peer connection using Godot's 'Multiplayer' class (MultiplayerAPI) and call the method HasPeers(). This should return true if there are any peers connected. Right now this always returns true.
I only want this to return true if there are peers connected (so not only yourself). I fixed this locally in my code by changing it to "Multiplayer.GetPeers().Length > 0"
Steps to reproduce
Create a ENetMultiplayerPeer and then call Multiplayer.HasPeers()
Minimal reproduction project
N/A