This document is about: PUN 2
SWITCH TO

PUN Classic (v1)、PUN 2 和 Bolt 處於維護模式。 PUN 2 將支援 Unity 2019 至 2022,但不會添加新功能。 當然,您所有的 PUN & Bolt 專案可以用已知性能繼續運行使用。 對於任何即將開始或新的專案:請切換到 Photon Fusion 或 Quantum。

Known Issues

On this page, we will list known issues with Photon on the various platforms.
The focus here is on issues which we can't fix or workaround.
In some cases, this means we will simply list broken versions per platform and guide you to other versions.

Mobile Background Apps

On mobile platforms, if the app moves to background it pauses the main message loop which is responsible for keeping the client connected among other things.

Typical causes of this are:

  • Player hits "home button".
  • Phone call received.
  • Video ads.
  • Third party plugin that introduces an overlay view in the app (e.g. facebook, Google, etc.).

PUN has a background fallback thread that keeps client connected to server.
This does not work on iOS (see Background Execution on the Apple dev pages).
To keep connection alive, the background thread sends ACKs only to server for a limited time.
The default background thread timeout is 60 seconds. You can change it using PhotonNetwork.KeepAliveInBackground.
After the background timeout, PUN will disconnect the client gracefully.
If the client was joined to a room before moving to background PUN will try -if needed- to reconnect and rejoin the same room as soon as the app is foreground again.

PhotonAnimatorView and Triggers

If you use Trigger parameters in animator controllers and
want to synchronize them using "PhotonAnimatorView", it's important to consider how this is handled to avoid issues.

  • Due to the nature of the Trigger(s), it is only enabled when the animation event starts and disabled immediately before the next Update()
  • Components on a GameObject are executed in the same order as they are declared
  • Editing the Order of Execution Settings will affect execution order on the GameObject's components

It essential that the "PhotonAnimatorView" component is executed after the code that raises the Trigger(s).
So it's safer to put it at the bottom of the stack,
or at least below the component(s) that will be responsible for raising the Trigger(s) using
Animator.SetTrigger(...).

The "PhotonAnimatorView" Inspector shows the various paramaters current values.
A good way to check even before publishing is that the Trigger is properly raised to true when it should.
If you don't see it happening, chances are this particular Trigger won't be synchronized over the network.

Unity

ArgumentException in Socket.SetSocketOption

There was a known Unity issue which caused IL2CPP builds to fail to connect with an "ArgumentException: Value does not fall within the expected range.
at System.Net.Sockets.Socket.SetSocketOption". This happened when the Windows 10 SDK 10.0.19041.0 was installed.

Affected Unity versions: 2018.4.23f1, 2019.4.0f1, 2020.1.0b11, 2020.2.0a13. Many more minor Unity releases have been affected, too.
Fixed versions are: 2020.1.1f1 and 2019.4.5f1 and up. Presumably, 2018.4.27 is also fixed. A workaround for 2018.4.23 exists as described here.

Unity 2018.2 Sockets Freeze with .Net 4.x

Unity 2018.2 used a Mono version, which could freeze communication via sockets. Depending on the message size and frequency, this happened sooner or later.

Eventually 2019.2 got a fix for this and 2018.3 should also have it at some point.

When using Mono and .Net 4.x or .Net Standard 2.0, we recommend to use the 2018.4.x or 2019.4.x releases.

RunInBackground

Unity's Application.runInBackground is not supported on mobile platforms.
Instead, the OnApplicationPause method is called whenever the app moves to or back from background:

C#

void OnApplicationPause( bool pauseStatus )
{
    if (pauseStatus)
    {
        // app moved to background
    } else
    {
        // app is foreground again
    }
}

Windows Store Capabilities

If you target Windows Store (UWP) and you are having exceptions when you try to connect or you have this error:

A network capability is required to access this network resource

Make sure to enable the required capability from Unity's "Player Settings" -> "Publisher Settings" -> "Capabilities -> "InternetClient"

Required Capability for Windows Store Apps
Required Capability for Windows Store Apps. You also need the 'Microphone' capability, if you use Photon Voice.

UWP Exports

If you want to export your Unity application to UWP you can either use .NET or IL2CPP as scripting backend. Photon PUN or Photon Realtime Unity SDKs are already configured to choose the correct library in order to successfully export the application from Unity. If however something goes wrong while exporting please check and make sure that you are using the correct library for the certain scripting backend:

If you are using .NET as scripting backend make sure that Photon3Unity3D.dll is used from /Assets/Photon/PhotonLibs/Metro/ directory

If you are using IL2CPP as scripting backend make sure that Photon3Unity3D.dll is used from /Assets/Photon/PhotonLibs/ directory

iOS IPv6

While Unity 5.x should support IPv6 on iOS in general, some versions (like 5.4) break this feature.
Some of the supported versions are: 4.7.2, 5.1.5, 5.2.5, 5.3.4p4, 5.4.0p1 and newer (see Unity blog post).

Asset Store Package Update

Sometimes assets are not updated at all or not updated properly from the Assset Store in some Unity versions.
Always verify Photon packages' versions either from the change log txt files or from PhotonServerSettings for PUN.
This is a known Unity issue, sometimes old packages are stuck in the local offline cache and updates do not occur at all or not properly.
To fix this, remove the Photon asset package locally first and try downloading / importing again.
The paths for the local Unity assets store cache folder are listed here.

Back to top