Chapter 2. Photon Unity Networking – The Chat Client
In the last chapter, we reviewed the Unity Networking API provided with the Unity game engine. In this chapter, we will review an alternative to Unity Networking, called Photon Unity Networking (PUN).
In this chapter, we will cover:
- How PUN works
- The differences and similarities between PUN and Unity Networking
- Setting up PUN with Photon Cloud
- Using PhotonViews
- Connecting to Photon
- Getting a list of rooms
- Creating and joining rooms
- Filtering lobby results by preference
- Automatic matchmaking
- Using FindFriends
- Syncing a level between players
- At the end of the chapter, we will create a chat client built on top of PUN
Photon Unity Networking is provided by ExitGames. It aims to provide an API consistent with Unity Networking, while at the same time solving many of the issues with Unity Networking, such as the dreaded NAT punch-through problem (players behind NAT are often unable to host games).
Photon Unity Networking works with another...