NetworkServer.Spawn() not spawning object at correct position

[EDIT] Nevermind I see that I am not spawning the instantiated object, but the prefab of that object on accident.

So from the manual I was under the impression that NetworkServer.Spawn() would spawn the GameObject at the same position and rotation that I instantiated it at. However what I am seeing is that NetworkServer.Spawn() is sending all the objects to 0,0,0. Despite the fact that I am instantiating the objects at custom positions, shown in this code below:

function SpawnObject(){
    print("Spawning Object");
    var go = Instantiate(game_object, Vector3(1, 2, 1.5), Quaternion.identity);
    NetworkServer.Spawn(game_object);
    }

The object spawns on both server and client. But on the client it is at 0,0,0, while the server has it where I instantiated it. Can someone tell me how to get it to spawn at the correct position? Thanks!!!

You are networking spawning the prefab, not the game object.

  • var go = Instantiate(game_object, Vector3(1, 2, 1.5), Quaternion.identity);
  • NetworkServer.Spawn(game_object);

I have exactly same problem, but I’m instantiate the correct object,
and it still happens

 public override void OnStartServer()
    {
        base.OnStartServer();
        cards = GenerateDeckInitial();
    }
    public override void OnStartClient()
    {
    
       Debug.Log("Cards CLIENT: " + cards.Count());
    }
    public SyncList<GameObject> GenerateDeckInitial() {
        SyncList<GameObject> cardsList = new SyncList<GameObject>();
        GameObject parentPosition = GameObject.Find("parentActions");
        foreach (var prefab in PrefabsActionCards)
        {
            Type ScriptCard = Type.GetType(prefab.name + ",Assembly-CSharp");
            var script = prefab.GetComponent(ScriptCard);
            var quantidade = (int)script.GetType().GetField("Quantidade").GetValue(script);
            for (int j = 0; j < quantidade; j++)
            {
                GameObject card = Instantiate(prefab, gameObject.transform.position ,gameObject.transform.rotation, gameObject.transform);            
                NetworkServer.Spawn(card);
                card.name = prefab.name.Replace("(Clone)", "");
                cardsList.Add(card);
            }
        }
        //ShuffleList(cardsList);
        //OrganizeCardHierarchy(cardsList, parentPosition, gameObject);
        return cardsList;
    }