Unity Example

The Unity example for a first-person shooter can be found in the UnityFPS folder. It is recommended to open the project in Unity 2020 or a higher version.

To run the project, follow the Unity step-by-step guide.

This project is based on the standard Unity 2020 First Person sample, adapted to showcase and demonstrate multiplayer functionality.

The project illustrates how multiple players can join a single game room, and while in the room, their coordinates are synchronized to create a shared playground where players can interact with both each other and scene objects.

The project consists of two scenes:

  • Start – the startup scene.
  • Playground – the scene containing the level, objects, and characters.

To adjust connection parameters, open the Start scene, select NetClient, and you will be able to manage the array of Auth services under the Auth Endpoints property. Additionally, in the inspector, you can fine-tune most of the connection-related and environmental properties that are available.

By exploring the NetClient class, you will gain an understanding of the connection procedure and the sequence for entering a room. It also encompasses the instantiation of player avatars and basic object management.

The PlayerBehaviour class is responsible for updating your player avatar, while PlayerBehaviour3rd is responsible for updating the avatars of other players.

The RoomObjectBehaviour class is in charge of tracking and defining the behavior of objects.