Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplayer Play Mode 1.0 fails to reload domain under specific circumstances #2900

Open
Yoraiz0r opened this issue Apr 26, 2024 · 1 comment
Labels
stat:awaiting triage Status - Awaiting triage from the Netcode team. type:bug Bug Report

Comments

@Yoraiz0r
Copy link

Description

I've tried using Multiplayer Play Mode, with Domain Reload disabled, and noticed that when I make code changes, the domain is not reloaded for the additional players at certain times.

After some experimentation, I've determined the problem comes through its interaction with the Jetbrains Rider Editor.

The problem was perceived such that when changing any code with Rider (such as Debug.Log("A") to B), the primary editor reloads domain properly, but other editors will not reload domain.

Attempting the same process with Visual Studio code properly reloads domains for other editors.

To understand what is going wrong with the interaction, I've locally pulled both the Jetbrains Rider Editor package and the Multiplayer Play Mode package.

Jetbrains Rider seems to be innocent in this case, only asking for an assets refresh.

Multiplayer Play Mode fails under its lambda event for vpContext.MainEditorSystems.AssetImportEvents.RequestImport, in Unity.Multiplayer.Playmode.VirtualProjects.Editor.MainEditorInternalRuntime.HandleEvents.
Specifically, it fails under this this section

                if (numAssetsChanged == 0)
                {
                    MppmLog.Debug("No assets to actually sync with clones.");
                    return;
                }

If the code is changed through visual studio, the numAssetsChanged is 1, but if Jetbrains Rider handles the code change, the event is only raised with numAssetsChanged being 0.

This numAssetsCheck seems erronous to me, since didDomainReload is set to true.

For now, I'm opting to locally solve this by changing this query to if (numAssetsChanged == 0 && !didDomainReload), which resolves the problems.

Reproduce Steps

  1. Create a new Unity project, with the Jetbrains Rider Editor and Multiplayer Play Mode packages installed.
  2. Create a MonoBehaviour with Start() { Debug.Log("A"); } and add it to a gameobject in an open scene.
  3. In the Project Settings/Editor/Enter Play Mode Settings enable Enter Play Mode Options and disable Domain Reload.
  4. Open Multiplayer Play Mode and enable a second player.
  5. Enter Play Mode, and witness both players logging "A".
  6. Exit Play Mode
  7. Using Jetbrains Rider, edit "A" to "B", and witness that only the primary player reloads domain.
  8. Enter Play Mode, and witness the primary player logging "B" while the second player logs "A".

Actual Outcome

Primary player reloads domain, but second player does not.

Expected Outcome

Both players reload domain, when code changes.

Environment

  • OS: Windows 10
  • Unity Version: 6000.0.0b13
  • Netcode Version: None, this is a Multiplayer Play Mode issue regardless of netcode.
  • Multiplayer Play Mode Version: 1.0.0.
  • Jetbrains Rider Editor version: 3.0.28.
@Yoraiz0r Yoraiz0r added stat:awaiting triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels Apr 26, 2024
@van800
Copy link

van800 commented May 3, 2024

This issue was also reported in the Rider bugtracker https://youtrack.jetbrains.com/issue/RIDER-111671/Riders-asset-refresh-on-code-change-does-not-trigger-Unitys-Multiplayer-Play-Modes-recompilation
I haven't found a way for work-arounding it on the Rider package side. Please see details in the YouTrack issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting triage Status - Awaiting triage from the Netcode team. type:bug Bug Report
Projects
None yet
Development

No branches or pull requests

2 participants