Unity-Technologies / Unity-Technologies/com.unity.netcode.gameobjects

Support cancelling MultiplayerService session joining functions

Open
#3,655 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

stat:imported type:feature
Dominant language
C#
Stars
2.3k
Forks
461
Avg merge
3d 16h
Merged PRs (30d)
20

Description

Is your feature request related to a problem? Please describe.
It takes several seconds to join a session through MultiplayerService. I'd like to let users cancel a connection attempt during the connection process.

Describe the solution you'd like
I'd like to pass cancellation tokens to functions like MultiplayerService.Instance.CreateOrJoinSessionAsync.

Describe alternatives you've considered
I've tried preventing the NetworkManager from connecting to a session if my own connection function wrapping MultiplayerService.Instance.CreateOrJoinSessionAsync is cancelled, but I cannot find a clean way to do this. I have also considered modifying the Unity.Services.Multiplayer package myself, but I would rather not do this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing MultiplayerService.Instance.CreateOrJoinSessionAsync and the NetworkManager connection flow to understand where a cancellation token would need to propagate. Done means users can cancel an in-progress session join through the MultiplayerService functions without modifying the package themselves.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.