#Netcode For Gameobjects | Instantiating Players Mid-Game

1 messages · Page 1 of 1 (latest)

vocal schooner
#

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

rigid iron
#

nope, you can't send a game object in a RPC like that.

vocal schooner
rigid iron
#

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()

vocal schooner
rigid iron
#

yea. just make a public list in the same script

vocal schooner
rigid iron
#

Why does it have to be static?

vocal schooner
#

am I mental? haha

rigid iron
#

Oh is this in a singleton? You should be able to use GameManager.Instance.playerPrefab[]

vocal schooner
#

Ohhhhkkkkkkkk

vocal schooner
rigid iron
#

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

vocal schooner