Unity 5.0 beta, build-target:WebGL

Options
caozane
caozane
edited March 2015 in DotNet
Hi,
I am trying to get the WebGL build target working with Unity 5.0 beta and Photon. I am using:

https://www.exitgames.com/Download/Phot ... -0-0-4.zip

At the download page it is stated that the WebGL build-target and Unity 5.0 beta is supported. I tested WebGL with:
demo-photon-chat from the Unity3D-Sdk

I changed the protocolType to Tcp:
this.Connect(this.NameServerAddress, ConnectionProtocol.Tcp, appId, appVersion, userId, authValues); [ChatClient.cs line 91]

This works with Unity 5.0 beta in general, that is I am able to connect to a chat session from the editor. When I use the WebGl build target the following exception is thrown when I try to connect:
An error occured running the Unity content on this page. See your browser's JavaScript console for more info. The error was:Uncaught abort() at Error at jsStackTrace (http://localhost:81/Release/WebGLTests.js:992:13) at stackTrace (http://localhost:81/Release/WebGLTests.js:1009:22) at abort (http://localhost:81/Release/WebGLTests.js:4313691:25) at _pthread_create (http://localhost:81/Release/WebGLTests.js:13126:59) at __ZN6il2cpp2os10ThreadImpl3RunEPFvPvES2_ [il2cpp::os::ThreadImpl::Run(undefined?F?*, void, void*)] (http://localhost:81/Release/WebGLTests.js:78538:9) at Array.__ZN6il2cpp2os6Thread3RunEPFvPvES2_ [il2cpp::os::Thread::Run(undefined?F?*, void, void*)] (http://localhost:81/Release/WebGLTests.js:70221:8) at Object.dynCall_iiii (http://localhost:81/Release/WebGLTests.js:4309063:45) at invoke_iiii (http://localhost:81/Release/WebGLTests.js:15095:34) at Array.__ZN6il2cpp6icalls8mscorlib6System9Threading6Thread15Thread_internalEP12Il2CppThreadP14Il2CppDelegate [il2cpp::icalls::mscorlib::System::Threading::Thread::Thread_internal(Il2CppDelegate?**)] (http://localhost:81/Release/WebGLTests.js:63450:8) at Object.dynCall_iii (http://localhost:81/Release/WebGLTests.js:4308776:44)If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information..........

Should this be working?

Could you possibly provide a Unity demo-photon-chat project which works as a WebGL build?

Comments

  • vadim
    Options
    Hi,

    PUN does not support Unity WebGL currently.

    Special PUN WebGL version is on early development stage and hardly can be used in production.
    You can find latest release and discussions on Photon WebGL Early Access group: https://groups.google.com/a/exitgames.c ... /pun-webgl
  • caozane
    Options
    Hi
    I am not using PUN. I am using the Unity 3D SDK, v4.0.0.4:
    https://www.exitgames.com/en/onpremise/download#unity3d

    Exports: All Supported (Mobile, PC, Consoles, Web, WebGL)
    Supported Versions: v4.3.x (Consoles), v4.6.x (Stable) , v5.x (Beta)
  • vadim
    Options
    Sorry, for Unity 3d SDK we do not have even experimental version.
    From SDK's readme:
    Currently supported export platforms are:
    Standalone (Windows, OSx and Linux)
    Web (Windows and MacOS)
    iOS (needs iOS Pro Unity license)
    Android (needs Android Pro Unity license)
    Windows 8 Store and Phone
    PS3, PS4 and XBox (certified developers should get in contact with us on demand)
  • caozane
    Options
    Ok. That is disappointing. Is there any plans or timelines for this? What are the major challenges? If you guys can't allocate resources for this, would it be possible for us to get access to the source code at create it our self? As far as I am concerned it is a relatively straight forward change to the transport layer.

    What is the timeline before the PUN client is stable?

    Could an alternate solution be to stitch something together using:
    Photon-OnPremise-Javascript-SDK_v3-2-1-4
  • gfoot
    Options
    You should be able to use the javascript SDK with your own C# bindings. It may even be the most performant way to use Photon from WebGL. Have a look at http://files.unity3d.com/jonas/WebSockets.unitypackage for an example of wrapping C# bindings around a Javascript library - in this case a custom WebSocket interface - and also the documentation linked below. It would be great to hear how you get on as I am considering something similar!

    http://docs.unity3d.com/Manual/webgl-in ... pting.html
  • caozane
    Options
    Ok. I do agree that this is a possible solution. Is this also what ExitGames officially recommends?
  • bertelmonster2k
    Options
    WebGL support in Unity 5 is in "preview" (this is how Unity calls it).

    And WebGL support from there is pretty tricky and we created an SDK available in early access. This is what we recommend to use:
    https://groups.google.com/a/exitgames.c ... /pun-webgl

    (A lot of people signed up, but the feedback is very sparse.)
  • Tobias
    Options
    Sorry for the late reply.

    Our recommended solution is to use PUN for the time being. When that is stable and WebGL export is out of beta in general, we can put more work into the regular DotNet SDK. The good news then is that the basics will already be working due to usage in PUN.

    PUN now includes the API to send your own events via PhotonNetwork.RaiseEvent. I don't see anything missing when you compare PUN with our regular SDKs.
    Please join the PUN WebGL Early Access group, give feedback on stability and let me know if you miss anything in PUN.
    https://groups.google.com/a/exitgames.c ... /pun-webgl

    Edit: I just figured out that you are likely in a team with a fully released game which "just" needs the updates. In that case, PUN is of course not a great option as you would have to rewrite a lot. I assume we can put some more work into the LoadBalancing API where needed. The first step would be to use our modified "basis" dll from PUN in a WebGL api. I will discuss with Chris when we can do this work.
  • caozane
    Options
    Tobias: You are absolutely correct. I do have a running project: www.kogama.com, based on this:
    https://www.exitgames.com/Account/SignI ... -0-0-4.zip

    All I basically need is that this plugin works with websockets (And of course the Unity WebGL build pipeline):
    Photon3Unity3D.dll

    I don't know a lot about PUN, but I suspect that what we are using is what PUN is using under the hood?

    As far as I know I am not even using the LoadBalancing API.

    I would be happy with a unstable demo build. But it is pretty business critical that I am able to connect to a server so I can estimate how realistic it is to use WebGL on our live servers.

    Can you guys possibly give me at time line for this?
  • Tobias
    Options
    The client side is pretty much done as initial version but as you host yourself, you will need to use the latest stuff on the server side.
    We will get in touch via mail. Chris or Philip should do.
  • caozane
    Options
    Great! Thx a lot :D