Skip to content

SceneName in SceneEvent contains inconsistent values #3418

@Edvinas01

Description

@Edvinas01

Description

When using automatic scene management, SceneName is inconsistently reported in NetworkSceneManager.OnSceneEvent.

Reproduce Steps

  1. Enable automatic scene management
  2. Subscribe to NetworkSceneManager.OnSceneEvent in networkManager.OnClientStarted
  3. Load a scene via NetworkSceneManager by passing in a full scene path (e.g., Assets/Scenes/GameScene_02.unity)
  4. Track SceneEvent.SceneName and SceneEvent.Scene arguments in OnSceneEvent callback

Actual Outcome

SceneEvent.SceneName in some event types contains the full scene path, in some only the scene name.

Expected Outcome

SceneEvent.SceneName should always be consistent - contain the full scene path or the scene name all the time.

Environment

  • OS: Windows 10
  • Unity Version: 6000.0.47f1
  • com.unity.netcode.gameobjects version: 2.3.2
  • com.unity.services.multiplayer version: 1.1.2
  • Distributed authority, using sessions

Additional Context

I'm using distributed authority:

var multiplayerService = MultiplayerService.Instance;

var options = new SessionOptions
{
    Name = multiplayerSessionNameId,
    MaxPlayers = 10,
    IsPrivate = false,
    IsLocked = false,
}.WithDistributedAuthorityNetwork();

await multiplayerService.CreateOrJoinSessionAsync(multiplayerSessionNameId, options);

Loading the scene as follows:

var scenePath = SceneUtility.GetScenePathByBuildIndex(index);
Debug.Log($"Starting to load scenePath={scenePath}");
sceneManager.LoadScene(scenePath, LoadSceneMode.Additive);

Tracking the OnSceneEvent the following way:

private void OnSceneEvent(SceneEvent sceneEvent)
{
    var sceneName = sceneEvent.SceneName;
    var eventType = sceneEvent.SceneEventType;
    var scene = sceneEvent.Scene;

    Debug.Log($"{eventType}: sceneName={sceneName}, scene.name={scene.name}, scene.path={scene.path}");
}

Log lines that get printed:

Starting to load scenePath=Assets/Scenes/GameScene_02.unity
Load: sceneName=Assets/Scenes/GameScene_02.unity, scene.name=, scene.path=
LoadComplete: sceneName=GameScene_02, scene.name=GameScene_02, scene.path=Assets/Scenes/GameScene_02.unity
LoadEventCompleted: sceneName=GameScene_02, scene.name=, scene.path=

Metadata

Metadata

Assignees

Labels

priority:mediumThis issue has medium priority and may take some time to be resolvedstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions