The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Unity (WebGL) Build doesn't work with Photon Pun

albertduranll
2020-07-07 17:21:06

Hi,

My teammates and I are trying to connect sucessfully between scenes in our Unity Project made for run in WebGL. When we load the scene after the register/login an error appears ans doen't let us play.

Screenshot: https://imgur.com/a/sNltQoa

  • Allways appears when we sitch to fullscreen in WebGL.
  • In the Unity Editor works fine.
  • We're working with Photon Pun: 2.18.1 and Photon lib: 4.1.2.19

Thanks!

Comments

Tobias
2020-07-08 11:52:10

The error log is from the Editor but you say it works in Editor?

I would recommend updating to PUN 2.19.x, which is the current version. In doubt, run one of our demos in WebGL to see if this exposes the same issue.

Which Editor version is this?

albertduranll
2020-07-08 14:40:10

Sorry, I'll try to explain step by step what have we done:

1.- Problem detected: We're trying to run our game on differents PC (higher and lower) and the problem is that usually when we load a new scene we get stuck just after the scene loading. It's important to remember that we're working for WebGL.

2.- After a long search on internet, we think that maybe the reason is a huge information load and maybe we can divide the Photon loading process to optimize the game.

3.- In the Unity Editor usually works fine. Yesterday we got the problem attached (https://imgur.com/a/sNltQoa) and we don't know if the reason is maybe the same as the comented on point 2*.

4.- On last thing we've detected is that the fullscreen mode of the WebGL build give us a lot of problems (the level load get stuck allways, and many other functions doesn't work).

  • Photon Pun Version: updated to 2.19.3
  • Unity Version: 2019.3.0f6
  • Project weight when zipped: 90MB
  • Host: itch.io (https://futuraspace.itch.io/multiplayer)
  • We're also working with PlayFab.

Thanks for the help.

albertduranll
2020-07-08 16:23:04

Ok, after a few more tests on WebGL we detect that the problem on the browser consoles is the same as the attached image in the first post.

https://imgur.com/a/FFKxJox

albertduranll
2020-07-08 16:57:55

I just tried to modify KeepAliveInBackground from 60000 (default value) to 200000 just to test following the instructions from another post. It didn't work but the errors that i'm recieving in the console are different. I attach another image of the last errors.

https://imgur.com/wK1XScP

Hope it helps

Tobias
2020-07-09 10:21:39

Thanks for the effort to get us into the picture.
The error you got reminds me of issues with the deserialization that we had a while ago for WebSockets. If the serialization protocol is not sent correctly to the server or changed, this makes the clients fail.
I saw that in your logs, somewhere protocol 1.6 is used (the older of two).

We tweaked the WebSocket implementations over time and I think it's worth getting the latest, to make sure we don't hunt a bug that's been fixed,
Please update PUN 2 entirely, make sure there are no changes in the Photon folder anymore (import PUN 2.19.3 into a new, empty project and copy the files over, in doubt) and then try again.

If you got issues with WebGL in general, I'd recommend updating to Unity 2019.4.latest. It's a long term support version and it will add stability to any export there is.

albertduranll
2020-07-13 13:35:29

Hi Tobias,

Thanks for the answer. We've tried it but we're getting other problem (just in the WebGL build) and don't let us see if the solution works or not. Did you know the reason that of the errors we're getting?

https://imgur.com/BHJT4tl

https://imgur.com/AOj5eci

Thanks!

Tobias
2020-07-17 14:52:22

Sorry, no, I don't see any hints at what's up.
I can recommend changing the Unity version, use a different browser and also: Run the PUN 2 package demos without modification. If they show the same issues, it may be Photon. Else, it can still be related to a lot of other packages.

Clint_B
2021-03-10 21:06:50

Did anyone ever find a solution to this? We are having the exact same WebGL exception issue. I know it's related to PUN because we removed all PUN code and it loads fine. Unfortunately, we've build an entire product around PUN. Would be a shame to have to revert all the way back to Unity 2017 (back when PUN worked in WebGL) just because we can't get PUN 2 to work properly with WebGL. Currently using the latest version of PUN 2 (imported today) and the latest LTS version of Unity 2019. Not confident in upgrading to 2020 yet but I will if people are having success with it.

Thanks in advance for any help.

Clint_B
2021-03-10 21:08:29

Also, it is happening in every browser we've tried.

Clint_B
2021-03-11 14:25:10

SOLUTION: For the issue with the exception shown in the image ( https://imgur.com/BHJT4tl ) posted by @albertduranll you have to enable exception handling in the WebGL build/player settings. Even if you have just a minor exception that might not be causing a crash (as in my situation), the browsers can't get past it if you don't have exception handling enabled.

Back to top