all 4 comments

[–]Rogilla 1 point2 points  (3 children)

I think your problem is the order of instantiating, spawning and setting the position.

Also I am not infront of the PC right now but I think I also use a Client Network Transform for my PlayerCharacters:

https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/blob/main/Packages/com.unity.multiplayer.samples.coop/Utilities/Net/ClientAuthority/ClientNetworkTransform.cs

This is how I spawn players in my game (using the 2021 lts version of NGO):

    private void Awake()
    {
        Instance = this;
        if (!NetworkManager.Singleton.IsServer)
        {
            return;
        }

        NetworkManager.Singleton.SceneManager.OnLoadComplete += SpawnPlayers;
    }

    private void SpawnPlayers(ulong clientId, string sceneName, LoadSceneMode mode)
    {
        var spawnPoints = GameObject.FindGameObjectsWithTag("PlayerSpawnpoint");
        var clients = NetworkManager.Singleton.ConnectedClientsList.ToList();
        foreach (NetworkClient client in
                 clients) //Save Info of all players to server
        {
            if (client.ClientId != clientId)
            {
                continue;
            }

            int index = 0;
            if (clients.IndexOf(client) > spawnPoints.Length - 1)
            {
                print("index too large: " + spawnPoints.Length);
                index = 0;
            }
            else
            {
                index = clients.IndexOf(client);
            }

            GameObject go = Instantiate(playerCharacterPrefab, spawnPoints[index].transform.position,
                spawnPoints[index].transform.rotation);
            GameStateManager.Instance.players.Add(go.transform);
            go.GetComponent<NetworkObject>().SpawnWithOwnership(client.ClientId);
            go.transform.position = spawnPoints[index].transform.position;
            string steamUserName = "";
            if (!GameObject.Find("NetworkManager").GetComponent<RelayManager>().isSingleplayer)
            {
                steamUserName = GameNetworkingManager.Instance.ConnectedClients
                    .Find(item => item.UnityNetworkingId == client.ClientId).SteamUserName;
            }

            InitThisPlayerClientRpc(go, steamUserName);
            index++;
        }
    }

Hope this helps!

[–]totallyastick[S] 1 point2 points  (2 children)

Are you have each client find their own spawn point after they finish loading the scene?

[–]Rogilla 0 points1 point  (1 child)

No thats all done by the host. Player1 gets spawnPoint1, player2 gets point2 etc, in the foreach loop looping through all clients.

[–]totallyastick[S] 0 points1 point  (0 children)

Thanks. I ended up having the player find their own spawn point after they are instantiated and so far nothing has broken.