PUN 2 UWP Build Errors

I am using Unity 2019.4.10. I am able to import PUN 2 and no errors are displayed after importing. But when I try to build for UWP then I am getting 113 errors.

Some errors include :

1. Assets\Photon\PhotonChat\Code\ChatPeer.cs(16,11): error CS0246: The type or namespace name 'ExitGames' could not be found (are you missing a using directive or an assembly reference?)
2. Assets\Photon\PhotonChat\Code\ChatPeer.cs(46,25): error CS0246: The type or namespace name 'IPhotonPeerListener' could not be found (are you missing a using directive or an assembly reference?)

Comments

  • rowlandjonathan
    edited September 2020
    Using PUN 2 (2.22 version)
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited September 2020
    Hi @rowlandjonathan,

    Thank you for choosing Photon!

    If you don't use Photon Chat try removing it completely and rebuild.
    Remove whole folder "Assets\Photon\PhotonChat".
  • Hi @JohnTube I have deleted the Photon Chat folder and now its reduced to 70 errors. I don't think I can delete files to solve any more errors. Here are some of the errors

    1. Assets\Photon\PhotonRealtime\Code\Room.cs(25,23): error CS0246: The type or namespace name 'ExitGames' could not be found (are you missing a using directive or an assembly reference?)
    2. Assets\Photon\PhotonRealtime\Code\Player.cs(23,11): error CS0246: The type or namespace name 'ExitGames' could not be found (are you missing a using directive or an assembly reference?)
  • rowlandjonathan
    edited September 2020
    Hi @JohnTube I just found this link https://doc.photonengine.com/zh-tw/pun/v2/troubleshooting/known-issues. Since I am using Unity 2019.4.10 (LTS) it automatically uses the IL2CPP scripting backend but how do I make sure that the "Photon3Unity3D.dll is used from /Assets/Photon/PhotonLibs/ directory" ?
  • rowlandjonathan
    edited September 2020
    Solved the errors by changing the Photon/PhotonLibs/Metro/Photon3Unity3D.dll's import setting. Changed the scripting backend as 'IL2CPP' with only WSAPlayer platform selected.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @rowlandjonathan,

    Thank you for sharing your fix.
    I think we were assuming that when IL2CPP is used, we automatically target .NET 4 and then "Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll" will be used instead.
    We will review.
  • @rowlandjonathan

    Thank you for posting your solution - I was having exactly the same issue!!
  • Solved the errors by changing the Photon/PhotonLibs/Metro/Photon3Unity3D.dll's import setting. Changed the scripting backend as 'IL2CPP' with only WSAPlayer platform selected.
    I tried to do this but I ran into a new problem

    Reference Rewriter found some errors while running with command "--target=Temp\StagingArea\Data\Managed\Assembly-CSharp.dll" "--target=Temp\StagingArea\Data\Managed\UnityEngine.SpatialTracking.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Tools.Runtime.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Services.TeleportSystem.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Services.SpatialAwarenessSystem.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Services.SceneSystem.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Services.InputSystem.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Services.InputSimulation.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Services.InputAnimation.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Services.DiagnosticsSystem.dll" "--target=Temp\StagingArea\Data\Managed\PhotonChat.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Services.CameraSystem.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.SDK.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Providers.XRSDK.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Providers.WindowsVoiceInput.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Providers.WindowsMixedReality.Shared.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Providers.WindowsMixedReality.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Gltf.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Async.dll" "--target=Temp\StagingArea\Data\Managed\Microsoft.MixedReality.Toolkit.Services.BoundarySystem.dll" "--target=Temp\StagingArea\Data\Managed\UnityEngine.XR.LegacyInputHelpers.dll" "--target=Temp\StagingArea\Data\Managed\PhotonRealtime.dll" "--target=Temp\StagingArea\Data\Managed\PhotonUnityNetworking.dll" "--target=Temp\StagingArea\Data\Managed\PhotonUnityNetworking.Demos.dll" "--target=Temp\StagingArea\Data\Managed\Unity.XR.WindowsMR.dll" "--target=Temp\StagingArea\Data\Managed\Unity.XR.ARSubsystems.dll" "--target=Temp\StagingArea\Data\Managed\Unity.XR.ARFoundation.dll" "--target=Temp\StagingArea\Data\Managed\Unity.Timeline.dll" "--target=Temp\StagingArea\Data\Managed\Unity.TextMeshPro.dll" "--target=Temp\StagingArea\Data\Managed\Unity.Subsystem.Registration.dll" "--target=Temp\StagingArea\Data\Managed\PhotonUnityNetworking.Utilities.dll" "--target=Temp\StagingArea\Data\Managed\RestSharp.dll" "--target=Temp\StagingArea\Data\Managed\Photon3Unity3D.dll" "--additionalreferences=Temp\StagingArea\Data\Managed,Temp\StagingArea\Data\Managed\Plugins\X64,Temp\StagingArea\Data\Managed\Plugins\ARM,Temp\StagingArea\Data\Managed\Plugins\ARM64,Temp\StagingArea\Data\Managed\Plugins\X86" "--platform=C:\Windows10SDK\UnionMetadata\10.0.19041.0\Facade\Windows.winmd" "--dbg=pdb" "--framework=Temp\StagingArea\Data\Managed"
  • ylhubeiwuhan
    edited October 2020
    I was having exactly the same issue. How did you solve it

  • How can I solve this problem
  • I think the new versions automatically sets the right import setting . I didn't have to change settings with new version. @ylhubeiwuhan
  • Yes, PUN 2.23 should have this fixed. It's easier you update, as you don't seem to know how to fix the export settings.
  • Joaquin
    Joaquin
    edited June 2023

    wow, 2023 and this bug is back

    We can't build for UWP in IL2CPP, i've tried changing the export settings, the placeholder, everything... no luck