#Scene Migration Synchronization issue

1 messages · Page 1 of 1 (latest)

lyric minnow
#

It's normally enabled by default. It might just not be supported when using Distributed Authority.

fallow citrus
#

using Unity.Netcode;
using UnityEngine;

namespace Unity.Multiplayer.Samples.SocialHub.Gameplay
{
class PlayerSpawner : NetworkBehaviour
{
[SerializeField]
NetworkObject m_PlayerPrefab;

    protected override void OnNetworkSessionSynchronized()
    {
        Debug.Assert(m_PlayerPrefab != null, $"Prefab reference '{nameof(m_PlayerPrefab)}' is missing or not assigned.");

        if (m_PlayerPrefab != null)
        {
            var spawnPoint = PlayerSpawnPoints.Instance.GetRandomSpawnPoint();
            m_PlayerPrefab.InstantiateAndSpawn(networkManager: NetworkManager, ownerClientId: NetworkManager.LocalClientId, isPlayerObject: true, position: spawnPoint.position, rotation: spawnPoint.rotation);
        }

        base.OnNetworkSessionSynchronized();
    }
}

}

#

the OnNetworkSessionSynchronized() method never gets called

lyric minnow
#

Can you downgrade your NGO to 2.1.1 and see if it works? Could be a bug introduced in later versions.

fallow citrus
#

I upgraded sample the lastest version it still works I couldnt find the difference but mine doesnt work again

lyric minnow
#

The only thing that would stop OnNetworkSessionSynchronized from firing would be if Scene Management was disabled in the Network Manager

fallow citrus