question

CodeHunter avatar image
CodeHunter asked

How to I spawn player prefabs using Party?

I've decided to try using Party to implement a Co-Op multiplayer system, but I can't find any leads about how I can properly spawn a player prefab. I can do something like this using MPS, but I'm trying to see if I can push the costs down using Party instead. (and probably, with network solutions like Mirror as well)

Specifications:

  • When a player connects to a network, their chosen player avatar will be spawned in all machines regardless if they're the host or guest
  • Each player can only control their avatar and other players', but they can still see the other avatars walking around and do stuff in their machine
  • When a player leaves the network, their assigned prefab is also removed from all other machines
unity3dmultiplayer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

The state synchronization and position synchronization features are implemented in Mirror. If you use party, you need to implement it yourself. When a player connects to the server, the prefab should be initialized based on the player's information to generate a player instance, and automatically join the Party network, constantly broadcasting its status and location information to other players in the network. In this way, all players know the status and location of other players, and if one player leaves, the other players will know in the same way.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.