Please note: development of Photon TrueSync & Thunder is ceased and we will not publish any further updates. While existings apps are not affected, we recommend to migrate apps that are still in development.

Configuring Photon Thunder

Configuration File

This file can be found inside your Resources folder, after you download and import the Thunder Package. It contains all major configurations needed to your Thunder project works.

Clicking on the configuration file, and going to the Inspector View you will be able to change the settings right from the editor, without the need of any code.

photon thunder configuration in the inspector view
Photon Thunder Configuration in the Inspector View

The main configuration fields are:

  1. Application ID: here you will need to put your project App ID created from your account with Photon. Just past it and you are ready to go.
  2. Hosting: this setting configure which type of server you will use.
  3. Photon Cloud: in this mode, the project will use a Photon server to manage the connection between your players. Using this, you can select a default region among all servers.
  4. Self hosted: you can use your own Photon server using this option. Just set the IP and Port of the hosted server.
self hosted server configuration
Self hosted server configuration
  1. Target Connection Type: this field configures the connection capabilities of your game instance, that can be:
  2. Punch + Relay: using this configuration, when a new player connects to your host, the NAT Punchthrough process will be performed to create a direct connection between the client and the host, if this step was not successful, it will fallback to the Relay Only connection.
  3. Relay Only: connection in which the data exchange is made using the Photon server as a Relay server. This type of connection can be more slow than the direct connection, but has the guarantee to always work.
connection type configuration
Connection Type configuration

How to change Thunder Configuration by code ?

The Thunder Configuration asset is a ScriptableObject, where all the settings can be changed at runtime, before enabling the matchmaker. To get access to this instance into your scripts, you can use the snippet below:


using UnityEngine.Networking;

public class RuntimeCfg : MonoBehaviour
  private PhotonThunderConfig config;

  void Start()
    this.config = PhotonUtils.getThunderConfig();

From there, you can change the settings using the reference instance:


void Configure() {
  // Set your Application ID
  this.config.appId = "e0daaa07-3e6e-4637-b47a-369372992d81";

  // Use your own self hosted server or the Photon server
  this.config.useLocalServer = false; // true to use self hosted server


  this.config.localServerIp = "";
  this.config.localServerPort = "7076";


  // Use the Punch + Relay connection
  this.config.connectionType = PhotonThunderConnectionType.PUNCH_RELAY;

  // Set the default region used to manage the connections
  // You can change US to any other region on the Enum
  this.config.currentRegion = PhotonRegions.Regions.US; 

  // Use the Relay Only connection
  this.config.connectionType = PhotonThunderConnectionType.RELAY;
Back to top