network objects name is not synchronized during instantiation?

hi all im having a weird issue where my gameobjects name is not being numbered on the client side. all the info i can find through googling points me to the obsoleted networkView so im not sure how to approach this. here my code it works perfectly on server side but it still has the suffix (“Clone”) on the client side

private void SpawnNewLobbyContainer()
    {
        sceneCanvas = GameObject.Find("Canvas");
        GameObject lobbyContainer = Instantiate(lobbyContainerPrefab);
        lobbyContainer.name = lobbyContainer.name.Replace("(Clone)", currentContainerCount.ToString());
        NetworkObject myNetworkObject = lobbyContainer.GetComponent<NetworkObject>();
        myNetworkObject.Spawn();
        myNetworkObject.TrySetParent(sceneCanvas.transform, false);
        lobbyContainer.transform.SetParent(sceneCanvas.transform, false);
        if (initialLobbyContainer == null)
        {
            initialLobbyContainer = myNetworkObject;
        }
        if (lobbyCount == 1 && initialLobbyContainerHasBeenScaled != true)
        {
            myLobbyContainerTranslator.TranslateContainerPosition(initialLobbyContainer);
            initialLobbyContainerHasBeenScaled = true;
        }
        if (lobbyCount > 0)
        {
            myLobbyContainerTranslator.TranslateContainerPosition(myNetworkObject);
        }
        currentContainerCount++;
    }

any advice apreciated

Try removing the “(Clone)” on OnNetworkSpawn

that worked just needed to change my logic a bit

1 Like