#Netcode For Gameobjects | Instantiating Players Mid-Game
1 messages · Page 1 of 1 (latest)
I'm having trouble implementing something like this, Would this be the right way to do this if the playerPrefab is a GameObject? or should it be a network object?
Netcode For Gameobjects | Instantiating Players Mid-Game
nope, you can't send a game object in a RPC like that.
So it would have to be a NetworkObject?
Nope. Can't send objects at all. The best way is to put the prefabs in a list. Then you can send the index of the one you want to spawn. Then you can instantiate playerPrefab[index]. Finally you would then call SpawnAsPlayerObject()
something like this?
And if so, how would I get access to the list of prefabs?
yea. just make a public list in the same script
The problem with that is that it would have to be static. Does that mean I have to add the prefabs through code since I cannot add them via the inspector?
Why does it have to be static?
Oh is this in a singleton? You should be able to use GameManager.Instance.playerPrefab[]
Ohhhhkkkkkkkk
Thanks a lot for your help! I still seem to be having that same from before, however.
Would you be interested in hopping into a call with me? I'm just starting my netcode for gameobjects journey. I could pay you for your time?
Sorry, don't have time for a dedicated call. But feel free to hit us up over on the Unity Netcode Discord server. I'm a mod there
I greatly appreciate your help!