PUN Classic (v1), PUN 2 and Bolt are in maintenance mode. PUN 2 will support Unity 2019 to 2022, but no new features will be added. Of course all your PUN & Bolt projects will continue to work and run with the known performance in the future. For any upcoming or new projects: please switch to Photon Fusion or Quantum.

What's new in v1.2.9

Main Changes:

For a full list of changes, check the log here.

New BoltMatchmaking Utility Class

In order to improve the Matchmaking capabilities of Photon Bolt, and provide a consistent API to handle the management of Bolt sessions, creating and joining game rooms using our Cloud services, we've included into this version a new class responsible to carry out all the necessary steps: BoltMatchmaking.

Here we list the main API of this utility class and a brief description of each method:

  • BoltMatchmaking.CurrentSession: Gets the current session this peer is connected to. This is useful if you want to get additional information about the session, like custom properties, for example.
  • BoltMatchmaking.CreateSession(string sessionID, IProtocolToken token, string sceneToLoad): Creates a Session using the current running Platform. You can optionally pass a Protocol Token (or a PhotonRoomProperties) and a scene identifier to be loaded with the room creation.
  • BoltMatchmaking.UpdateSession(IProtocolToken token): Updates the current session configuration. The local peer needs to be the Server in order to call this method.
  • BoltMatchmaking.JoinSession(string sessionID, IProtocolToken token): Joins a Session by name. You can use the same Session identifier used to create the session to join it immediately.
  • BoltMatchmaking.JoinSession(UdpSession session, IProtocolToken token): Joins a Session using a UdpSession as reference. You can search for UpdSessions using the SessionListUpdated callback or looking at the BoltNetwork.SessionList.
  • BoltMatchmaking.JoinRandomSession(IProtocolToken token): Joins a Session in a random fashion. This call will make your client join any available session using the default enter mode, where the peer is allocated to fill the rooms as fast as possible.
  • BoltMatchmaking.JoinRandomSession(UdpSessionFilter sessionFilter, IProtocolToken token): Joins a Session in a random fashion. On this overload, you can filter the rooms the player can join making use of the UdpSessionFilter class and pass custom parameters.

You can find more information on how to use this class on the it's own dedicated page here.

Extended Entity API

On this version, we've extended the BoltEntity API with extra methods mainly focused on the Command System. These methods give you better control over the internal Input Command Queue on the entity.

  • BoltEntity.IsInputQueueFull: each entity has a limited number of commands that can be queued (60 by default), this property signals if the internal queue is full or not.
  • BoltEntity.ClearInputQueue(): calling this function, for a particular entity, the internal command queue will be cleared and all commands discarded.
  • BoltEntity.QueueInput(Command cmd, bool force): it was added a new argument to the QueueInput function, a boolean that signals if the command must be queued independently if the input queue is full (in this case, discard the oldest command) or not. This flag is set to false by default.

All these methods are intended to be used only on certain advanced scenarios: when the entity queue gets full due to a slow network connection or you want to reset the command list while reconnecting to a game host, are some examples. On usual circumstances, you will not need to use these functions, but they can be very useful.

Bolt folder Hierarchy

Following the convention of other products from the Photon family, the Photon Bolt SDK now lives inside the <Unity Project>/Assets/Photon/PhotonBolt folder, that contributes to a better code organization if you are also using another solution, like the Photon Voice SDK. Also, on this version, we've exposed the internal usage of the Photon Realtime SDK to the Unity project surface, which can lead the faster updates when there is any improvement and opens the possibility (planned for future versions of Bolt) to use custom Realtime Clients (LoadBalancingClient) implementations as the base client for Bolt integration with the Photon Cloud.

new photon bolt folder hierarchy
New Photon Bolt Folder Hierarchy.

Assembly Definitions Support

Assembly Definitions is an interesting way of organizing scripts inside a Unity project into different managed assemblies, as it can grant compilation performance and better dependency management between libraries and your code. You can read more about this topic here.

Photon Bolt now includes its own Assembly Definition configuration for the main SDK and also support user-defined assemblies (through the .asmdef) files. We've included the support looking for improvements on the development/compilation time while using Bolt. Make sure the run the Bolt compiler (Bolt/Compile Assembly menu) after you define a new assembly on your project, as the library needs to search and register them in order to be able to load all Bolt related classes, like yours GlobalEventListener classes, for example.

photon bolt unity project using assembly definition to organize the code
Photon Bolt Unity project using "Assembly Definition" to organize the code.
Back to top