Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

How to run a WebGL build of the TrueSync package?

$
0
0
This is the process I used to attempt to create a WebGL build.

Initially I had two errors as follows:
AddComponent with MonoBehaviour is not allowed. Create a class that derives from MonoBehaviour and add it instead.
UnityEngine.GameObject:AddComponent()
ExitGames.Client.Photon.SocketWebTcp:Connect() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/SocketWebTcp.cs:79)
ExitGames.Client.Photon.TPeer:Connect(String, String)
ExitGames.Client.Photon.PhotonPeer:Connect(String, String)
NetworkingPeer:ConnectToNameServer() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:619)
PhotonNetwork:ConnectToBestCloudServer(String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1470)
PhotonNetwork:ConnectUsingSettings(String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1281)
Menu:MainPanel_MultilayerBtn() (at Assets/Demo/Menu.cs:119)
Menu:MainPanel_SetLobby(String) (at Assets/Demo/Menu.cs:112)
UnityEngine.EventSystems.EventSystem:Update()

NullReferenceException: Object reference not set to an instance of an object
ExitGames.Client.Photon.SocketWebTcp.Connect () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/SocketWebTcp.cs:85)
ExitGames.Client.Photon.TPeer.Connect (System.String serverAddress, System.String appID)
ExitGames.Client.Photon.PhotonPeer.Connect (System.String serverAddress, System.String applicationName)
NetworkingPeer.ConnectToNameServer () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:619)
PhotonNetwork.ConnectToBestCloudServer (System.String gameVersion) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1470)
PhotonNetwork.ConnectUsingSettings (System.String gameVersion) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1281)
Menu.MainPanel_MultilayerBtn () (at Assets/Demo/Menu.cs:119)
Menu.MainPanel_SetLobby (System.String config) (at Assets/Demo/Menu.cs:112)
UnityEngine.Events.InvokableCall`1[System.String].Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:188)
UnityEngine.Events.CachedInvokableCall`1[System.String].Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:306)
UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:634)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:769)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:52)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:269)
UnityEngine.EventSystems.EventSystem:Update()

I resolved these errors by changing line 79 in SocketWebTcp.cs from:
MonoBehaviour mb = websocketConnectionObject.AddComponent<MonoBehaviour>();
to:
MonoBehaviour mb = websocketConnectionObject.AddComponent<MonoBehaviourExt>();
and adding this line at the bottom of the file:
internal class MonoBehaviourExt : MonoBehaviour { }
Then I received more errors after trying to run the TrueSync boxes demo in the Unity Editor, which is set to build to WebGL. After entering a nickname I click on "Demo Boxes" to get these errors:
Operation failed: OperationResponse 230: ReturnCode: 32767 (Empty application id). Parameters: {} Server: NameServer
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1420)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.TPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)

The appId this client sent is unknown on the server (Cloud). Check settings. If using the Cloud, check account.
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1451)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.TPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)

I resolved these errors by setting the PhotonServerSettings configuration to:

Viewing all articles
Browse latest Browse all 15755

Trending Articles