Quickstart
Package Import
Please follow this step-by-step guide to resolve common problems during Unity Asset Store package import process.
💡Note: You can skip package import process if you downloaded the sample from the Photon website. Open the project directly in the correct Unity version (2021.3) and proceed to step 10.
- Create a new Unity 3D project. We recommend using Unity 2021.3.
![](/docs/img/fusion/v2/samples/projectiles/import-01.jpg)
- Open Package Manager and import Projectiles Advanced package.
![](/docs/img/fusion/v2/samples/projectiles/import-02.jpg)
- In project settings overwrite warning, select Import.
![](/docs/img/fusion/v2/samples/projectiles/import-03.jpg)
- In package dependencies warning, select Install/Upgrade.
![](/docs/img/fusion/v2/samples/projectiles/import-04.jpg)
- The sample uses the new Input System package which requires Unity Editor to restart, select Yes.
![](/docs/img/fusion/v2/samples/projectiles/import-05.jpg)
- The Unity Editor automatically restarts. Unfortunately the import process doesn't continue, please repeat steps 2, 3, 4. This time you'll not need to restart the Unity Editor again.
- On Import Unity Package, select Import.
![](/docs/img/fusion/v2/samples/projectiles/import-06.jpg)
- The package will be imported into the project.
- If the Photon Fusion Hub pops up, fill in the Fusion 2 AppId - more info in App Id Setup
![](/docs/img/fusion/v2/samples/projectiles/import-12.jpg)
- Check the Starting The Game section below for detailed instructions on how to play the game in the Editor.
App Id Setup
To run the sample, the Fusion 2 AppId needs to be assigned in the PhotonAppSettings
asset.
First, create a Fusion 2 AppId in the Photon Engine Dashboard and paste it into the App Id Fusion
field in the PhotonAppSettings
(reachable from the Tools/Fusion/Realtime Settings
menu or directly modifying file Assets/Photon/Fusion/Resources/PhotonAppSettings.asset
).
![photonappsettings](/docs/img/fusion/v2/samples/projectiles/photon-app-settings.png)
Starting The Game
Debug Start
Start a game by opening and playing the Deathmatch
scene (Scenes/Deathmatch
). Choose the mode in which the game should be started.
Multipeer
For testing how projectiles behave on proxies, it is highly recommended to use the multi-peer mode. To enable multipeer mode, change Peer Mode
to Multiple
in the NetworkProjectConfig
asset (Photon/Resources/NetworkProjectConfig
). Upon starting the scene with multipeer mode enabled, choose Start Host
, and the game will initiate with the specified number of clients (2 by default).
To switch between peers, press the 0
, 1
, 2
, and 3
keys on the numpad.
It is also possible to switch peers using the Runner Visibility Controls
window (top menu Fusion/Windows/Runner Visibility Controls
).
![runner visibility controls](/docs/img/fusion/v2/samples/projectiles/fusion-projectiles-runner-visibility-controls.png)
To see how shooting behaves on a proxy, set only Client A as visible, and only enable Client B as an input provider. Your shooting from Client B now can be observed from Client A’s perspective.
![runner visibility controls](/docs/img/fusion/v2/samples/projectiles/fusion-projectiles-runner-visibility-controls-2.png)
💡Note: For multipeer mode to work properly it is essential to avoid referencing scene objects through static fields (access to UI, camera rig, player data etc.) but avoiding statics is a good and recommended practice in general as well. Check the SceneContext section for one solution to how common objects can be accessed throughout your codebase.
Controls
Use W
, S
, A
, D
for movement, Mouse1
for fire and Mouse2
for alternative fire if available. Weapons can be switched by pressing the appropriate alpha number key. Check the ingame UI for information about the selected weapon and types of projectiles it shoots.
Use the ENTER
key to lock or release your cursor.
![first play](/docs/img/fusion/v2/samples/projectiles/fusion-projectiles-first-start.png)
Project Organization
Prefab Type | Location |
---|---|
Player and player agent | /Prefabs |
Weapons | /Prefabs/Weapons |
Projectiles | /Prefabs/Projectiles |