enter image description here

public void CmdCreateSelection()
    {
        List<GameObject> myLocalList = new();
        for (int i = 0; i < cardsPrefab.Count; i++)
        {
            GameObject card = Instantiate(cardsPrefab[i], holder);
            card.tag = "CreateDeck";
            card.GetComponent<CardType>().prefab = cardsPrefab[i];
            myLocalList.Add(card);
            NetworkServer.Spawn(card);
            TargetCreateSelection(card.transform); <----------- ERROR OCCURED HERE 
        }

    }

    [TargetRpc] 
    public void TargetCreateSelection(Transform card)
    {
     card.SetParent(holder,false);
    }

After changing the Scene froom Lobby scene to game scene, instiating the cards on server,use TargetRpc to tell other clients, to parent specified card, spawned on server, but get an error.

Object on which this code is called is a sceneObject, which is inactive before the player load scene.

Using Mirror.

Already trying to call TargetCreateSelection, without any action in method, but same error occurred.

Couldn't understand why this error occurred.

Why Error occurred and how to fix it ?????????

0

There are 0 best solutions below