Skip to content

Automatic addition of current scene does not inform Editor that object serialization changed #599

Description

@becksebenius-unity

Describe the bug
NetworkManager will automatically add the current scene to its "RegisteredScenes" list. It does this by directly adding the scene to the RegisteredScenes list (NetworkManager.cs:214 on #a0e87b3b79) but it does not call EditorUtility.SetDirty on the object. This means that if there are no other changes to the NetworkManager, the object/scene is not flagged for reserialization and may not be saved to disk.

To Reproduce
Steps to reproduce the behavior:

  1. Create a saved scene on disk
  2. Add a network manager to the scene
  3. Note that the network manager will automatically add the registered scene, but because you just made a change it will be added correctly
  4. Rename or Duplicate your scene
  5. Open the scene but make no further changes
  6. Select the NetworkManager (may not be necessary)
  7. Observe that the NetworkManager automatically added your current scene to its settings, but no other changes were made to the scene
  8. Close Unity
  9. Notice that there is no "Unsaved changes" prompt

Expected behavior
When automatically updating serialized data in the network manager, the editor needs to be informed so that the data is saved correctly

Environment (please complete the following information):

  • OS: Win10
  • Unity Version: 2020.2.7f1
  • MLAPI Version: 0.1.0
  • MLAPI Commit: a0e87b3

Additional context
I mainly witnessed this behavior when running MultiPie. Because the configuration change is not saved, the remote client and server disagree on the network manager configuration. Users would likely observe the same behavior when testing their game with sym links.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions