Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.13k
stars
432
forks
source link
Apparent state machine problem in NetworkManager #1595
Describe the bug
Essentially, calling Shutdown() while not in hosting or client mode triggers a state machine problem that prevents host mode from starting normally.
Additional context
Further unexpected behavior can be found by adding the following reproduction steps beyond the above set:
Click Become Host
🙂 NetworkManager changes to host mode. Also, a new ConnectedClient game object is inserted into the scene.
Click Shutdown
Click Shutdown again
Click Become Host
😢 NetworkManager does not change to host mode. Also, the ConnectedClient game object does not get created.
Click Become Host again
🙂 NetworkManager changes to host mode. Also, a new ConnectedClient game object is inserted into the scene.
Additional additional context
This was discovered while trying to enable players to arbitrarily switch between being a host and a client (and back). I know it ventures into feature request territory to mention this, but as an API consumer I feel that host/client-mode state management would be a lot simpler to manage if StartHost(), StartClient(), and Shutdown() were all smart enough to transition between states on their own, and were idempotent where applicable.
Describe the bug Essentially, calling
Shutdown()
while not in hosting or client mode triggers a state machine problem that prevents host mode from starting normally.A sample project that exhibits this behavior can be found at https://github.com/xaroth8088/unity-networkmanager-bug
To Reproduce Steps to reproduce the behavior:
Shutdown
Become Host
Actual outcome
NetworkManager
does not change to host mode. Also, theConnectedClient
game object does not get created.Expected outcome
NetworkManager
changes to host mode. Also, a newConnectedClient
game object is inserted into the scene.Screenshots N/A
Environment (please complete the following information):
Additional context Further unexpected behavior can be found by adding the following reproduction steps beyond the above set:
Become Host
🙂
NetworkManager
changes to host mode. Also, a newConnectedClient
game object is inserted into the scene.Shutdown
Shutdown
againBecome Host
😢
NetworkManager
does not change to host mode. Also, theConnectedClient
game object does not get created.Become Host
again🙂
NetworkManager
changes to host mode. Also, a newConnectedClient
game object is inserted into the scene.Additional additional context This was discovered while trying to enable players to arbitrarily switch between being a host and a client (and back). I know it ventures into feature request territory to mention this, but as an API consumer I feel that host/client-mode state management would be a lot simpler to manage if
StartHost()
,StartClient()
, andShutdown()
were all smart enough to transition between states on their own, and were idempotent where applicable.