Setup guide for Dynamic Water Physics 2 multiplayer using Photon Unity Networking 2 framework.
PUN2 demo scene is included with the asset.
Check the Photon Unity Networking 2 setup with a provided Photon demo scenes (e.g. slot cars) to verify that the Photon setup has been done correctly
Adding PUN2 to the scene
- Create a new GameObject and name it PhotonManager.
- Add OnJoinedInstantiate and ConnectAndJointRandom to the newly created object.
- Set position offset to some higher value (e.g. >10).
- Set Auto Connect to true.
The scene should contain required InputProviders for the input system that is being used. More about Input here.
Adding PUN2 to the ship
- Add PhotonMultiplayerShip component to your ship. This will automatically add other necessary scripts.
- Make sure that under Photon View component Observe option is not set to Off. Any other option can be used.
- Observed Components should look as in the following image. If any component is missing from the list add it.
Instantiating
- Objects that will be instantiated by OnJoinedInstantiate need to be placed under Resources folder. If there is no such folder, one needs to created, its location does not matter. Drag the ship prefab to that folder.
- Assign the vehicle prefab under Prefabs To Instantiate of OnJoinedInstantiate script.
- Press Play. Vehicle will instantiate after a few seconds.
- Build the project and open two windows side by side to test it out.