1
votes

I am testing out unity networking for a game i am working on. I can spawn object on all clients, but i cant move the spawn point with a network start position object. Unity documentation tells me that the network manager looks for network start position scripts in the scene and spawns them randomly or with round robin on these.

Scene overview: https://i.imgur.com/pVIMpEa.png

Network Manager: (https://i.imgur.com/DKwCe17.png)

Network Start Position: (https://i.imgur.com/PTdFe1q.png)

I got it to work. My problem was that the network manager spawned a connection object, the object then instantiated the player. I just added this.transform to the Instantiate function.

Instantiate(PlayerUnitPrefab, this.transform);
1
This seems like a little bit redundant. why do you spawn a "PlayerConnectionObject" which then just instantiates your Player Prefab, instead of just providing that PlayerPrefab to the NetworkManager.Senbazuru

1 Answers

0
votes

Your question is a little vague but I'll try to answer as best I can.

When it comes to spawning a player object when the match starts (either on startHost() or startClient()), the engine will check all objects in the scene to find any with the NetworkStartPosition component and use the spawning method assigned on the NetworkManager to spawn the player (either Round Robin or Random).

Now from the sounds of it you're unable to assign an actual spawn point for the NetworkManager to use. This could be anything from the object not having a NetworkIdentity to you having attached the wrong class to the object.

If you can provide screenshots of the NetworkManager, the NetworkSpawnPoint GameObject, and the object in your scene, this would help us figure out why it's spawning the player at your spawn points.