Reputation: 45
I'm trying to create a 3D game using unity's out of the box network manager class. In this game players can run around, shoot and pickup other weapons.
The player prefab has a NetworkIdentity, and each gun type also has a NetworkIdentity.
When a player joins the game, I want them to spawn with a default gun. However I'm having an issue getting the player to spawn with a default gun, because guns have a NetworkIdentity. Everything is spawned okay, but I cannot change the client owner of the spawned weapon, so the player cannot shoot or reload the weapon they start with. Weapons they pickup in the world after spawning work just fine.
This seems like the same problem as mine, but no one responded.
How should prefabs be organized for unet games? Is it possible to have the default network manager class spawn prefabs that contain nested NetworkIdentity script instances?
Upvotes: 0
Views: 552
Reputation: 2069
Take a look at ClientScene.AddPlayer, NetworkManager.AddPlayer, And using NetworkManager
You can override OnServerAddPlayer
on NetworkManager your own.
Using extraMessage will let you know your player's informations.
Upvotes: 0