Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all 8947 articles
Browse latest View live

Exception in PhotonView

$
0
0
I ran into this today. There is probably something wrong my setup, but still, it shouldn't cause exceptions. I'm using PUN 2.9
(Filename: C:/Projects/IncidentCommander/IC_Unity/Incident Commander/Assets/Plugins/Photon/PhotonUnityNetworking/Code/PhotonView.cs Line: 367) NullReferenceException: Object reference not set to an instance of an object at Photon.Pun.PhotonView.SerializeComponent (UnityEngine.Component component, Photon.Pun.PhotonStream stream, PhotonMessageInfo info) [0x0003b] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonView.cs:367 at Photon.Pun.PhotonView.SerializeView (Photon.Pun.PhotonStream stream, PhotonMessageInfo info) [0x00035] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonView.cs:329 at Photon.Pun.PhotonNetwork.OnSerializeWrite (Photon.Pun.PhotonView view) [0x00085] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1520 at Photon.Pun.PhotonNetwork.RunViewUpdate () [0x000a9] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1449 at Photon.Pun.PhotonHandler.LateUpdate () [0x00025] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonHandler.cs:132

Cannot send to: xxx.x.xx.xxx. Not enough buffer space is available

$
0
0
I was trying to search for a solution for this but i'm having issues with running the game on the laptop (this is for IOS though) but still strange its closing the game with this error. Anyone know why it would be doing this?
Cannot send to: xxx.x.xx.xx. Not enough buffer space is available UnityEngine.Debug:LogError(Object) NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1522) ExitGames.Client.Photon.<>c__DisplayClass145_0:b__0() ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)

LeaveRoom() and PlayerTTL

$
0
0
if player call LeaveRoom then still room keep player information to rejoin for duration playerTTL set?

How to use CountdownTimer.cs script from pun2 demo

$
0
0
As the title states, I am aware of the script. I am using this to create room,
RoomOptions roomOps = new RoomOptions() { IsVisible = true, IsOpen = true, MaxPlayers = 2 };
        PhotonNetwork.CreateRoom("room" + randomRoomName, roomOps);
Can anyone help, how can I use the countdowntime script so that I can sync the finishedloadingscreen across the network. Thanks.

Oculus Avatar

$
0
0
https://doc.photonengine.com/ko-kr/pun/current/demos-and-tutorials/oculusavatarsdk I am trying to connect the Oculus Avatar with Photon. I made a prefab of LocalAvatar and RemoteAvatar according to the tutorial, but I am not able to follow 'Instantiating Avatars' part. Where is the more detailed description? In fact, I do not even know how to make and apply the script as beginner. Please help me.
using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; using Photon.Realtime; public class Launcher : MonoBehaviour, IOnEventCallback { public readonly byte InstantiateVrAvatarEventCode = 123; public void OnJoinedRoom() { int viewId = PhotonNetwork.AllocateViewID(); RaiseEventOptions raiseEventOptions = new RaiseEventOptions { CachingOption = EventCaching.AddToRoomCache, Receivers = ReceiverGroup.All }; SendMessageOptions sendOptions = new SendOptions { Reliability = true }; PhotonNetwork.RaiseEvent(InstantiateVrAvatarEventCode, viewId, raiseEventOptions, sendOptions); } public void OnEvent(EventData photonEvent) { GameObject go = null; if(PhotonNetwork.LocalPlayer.ActorNumber == photonEvent.Sender) { go = Instantiate(Resources.Load("LocalAvatar")) as GameObject; } else { go = Instantiate(Resources.Load("RemoteAvatar")) as GameObject; } if(go != null) { PhotonView pView = go.GetComponent(); if (pView != null) { int viewId = (int)photonEvent.CustomData; pView.ViewID = viewId; } } } public void OnEnable() { PhotonNetwork.AddCallbackTarget(this); } public void OnDisable() { PhotonNetwork.RemoveCallbackTarget(this); } }

WebSocket is closed before connection is established.

$
0
0
Hello everyone, I'm having a odd error appearing in dev console.. I can't connect to Photon cloud usign WebGL build.. Everything is set-up correctly, according to guides and so on. (Connection type is set to Web Socket in photon settings).

Players not joining the same room

$
0
0
Hi, I have followed the tutorial for creating rooms specific to number of players limit per room. I have two instances of my project running on Windows (one is running on Unity Editor and the other is Windows PC build) When I press play the master client joins a random room for 1 but when I run my second instance (build) it should load room for 2 but it doesn't It's not happenning according to the documentation and I followed each step Edit: I also have AutomaticSyncScene=true in script which should handle this scenario Any help would be appreciated

WebGL: WebSocket is closed beforce connection is established.

$
0
0
Title says it all, what to do? You may find the game on: https://logantheoverlord.github.io/PlayTDPR/ Any help appreciated!

How do you manage your network state?

$
0
0
Hello! How do you manage your network state? I'm currently developing a card game in unity with PhotonUnityNetworking 2 and PhotonRealtime The project is gonna be failed due to my inability to make persistent multiplayer gameplay I often encounter disconnects and desynchronizations of my game state Consider next flow to get in game: - Create a table (Room) - Wait till other players join (4 player overall) - Start game screen and share game events between players First of all. How do you connect? Imagine that I'm in main menu. I'm pressing "Tables list" button and want to see all opened tables at the moment. I need to be in lobby. Ok, I just call `PhotonNetwork.ConnectUsingSettings()` but wait! What if I am already connected? Ok, check if `PhotonNetwork.IsConnectedAndReady` is true. I am connected and ready to see tables. What if I forgot to leave previous room and in some room now? I check if `PhotonNetwork.InRoom` is set to false, ok, it's already 2 checks I need to do to make sure I can list all current tables (why cached rooms was removed from the latest and I need to do some magic with Dictionary by myself?). Let's assume I see tables and entering one. I see a list of players that pressed "I'm ready" button (Keeping that in room properties? I need to see count of "ready" players in lobby). Pressing "Ready" and send an event to master client to add me in properties. 4 players are ready - it's time to play. Game screen is shown and master makes its things to make it work. Suddenly I got disconnect because of connection fail - I restored my connection and want to get back into the game. I call `PhotonNetwork.ReconnectAndRejoin()` and this command often fails due to different reasons (Not connected - connect master server first, OpRoomJoin failed, etc..) and a lot of checks and callbacks I need to do again - game experience is failed. I expect my controllers to be hard-binded to network context. I made a wrapper that turns any photon callback/hook into a task with try/catch and timeout just in case (Makes something like `await PhotonManager.EnsureInLobby()`) I made that wrapper twice for 4 month from scratch. Is my way of thinking about network-programming wrong?

Scene object

$
0
0
How to get event call for Scene object instantiated for non master client players.

Make networked objects visible in two different scenes?

$
0
0
I have a game where where there are two scenes which separates a VR player and an AR player. In the VR scene there is a room with some objects that the VR player can interact with, and they are also instantiated. The AR player, which gets sent to the other scene, is made with ARCore. He is only supposed to see the VR player prefab, and the objects he is interacting with, but I have not found a way to make these objects visible in the AR scene. Does anyone have an idea of how this can be done?

Exception: Can't add. Size exceeded.

$
0
0
I have a Dictionary that I am trying to send in OnPhotonSerializeView. Unfortunately, when I do this, it throws an exception as follows-
Exception: Can't add. Size exceeded. at Photon.Pun.PhotonNetwork+SerializeViewBatch.Add (System.Collections.Generic.List`1 viewData) [0x00034] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1390 at Photon.Pun.PhotonNetwork.RunViewUpdate () [0x00123] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1467 at Photon.Pun.PhotonHandler.LateUpdate () [0x00025] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonHandler.cs:132
Is this not supported? The docs on Serialization says it should be. I'm using PUN 2.9 and my code is simple-
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { stream.SendNext(MyData); } else { MyData = stream.ReceiveNext() as Dictionary); } }
I have verified that MyType otherwise works correcty, and also sending arrays of the keys and values also works as a workaround. It just doesn't seem to like my Dictionary.

Still seeing timeouts after setting IsMessageQueueRunning to false

$
0
0
I'm working on a VR app using photon for networking, and having disconnect issues on load. based on the official documentation at the bottom of the page on: https://doc.photonengine.com/en-us/pun/current/troubleshooting/analyzing-disconnects#tweak_resends it looks like once IsMessageQueueRunning is set to false, photon spins up a background tread to listen to events while a blocking load happens, then setting IsMessageQueueRunning will resume normal processing. Every time I see: Receiving failed. SocketException: ConnectionReset UnityEngine.Debug:LogError(Object) Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String) (at Assets/Core/Plugins/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1835) ExitGames.Client.Photon.<>c__DisplayClass101_0:b__0() ExitGames.Client.Photon.TPeer:DispatchIncomingCommands() ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Core/Plugins/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:130) followed by UnityEngine.Debug:LogWarningFormat(String, Object[]) NetworkConnectionManager:OnDisconnected(DisconnectCause) (at Assets/Core/Main/NetworkConnectionManager.cs:103) Photon.Realtime.ConnectionCallbacksContainer:OnDisconnected(DisconnectCause) (at Assets/Core/Plugins/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3253) Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Core/Plugins/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2382) ExitGames.Client.Photon.<>c__DisplayClass102_0:b__0() ExitGames.Client.Photon.TPeer:DispatchIncomingCommands() ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Core/Plugins/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:130)

I keep getting (The requested feature is not implemented)

$
0
0
I get the error NotImplementedException: The requested feature is not implemented. Photon.Realtime.LoadBalancingClient.OpCreateRoom (Photon.Realtime.EnterRoomParams opParams) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1485) and i dont know why this is happening when i see other people using the code PhotonNetwork.CreateRoom(roomName, roomOps); which should work.

Errors during import

$
0
0
Hi, I want to add the PUN package, but after adding I receive 19 errors: Assets/Photon/PhotonUnityNetworking/Demos/DemoAsteroids/Scripts/Game/AsteroidsGameManager.cs(128,30): error CS0115: `Photon.Pun.Demo.Asteroids.AsteroidsGameManager.OnMasterClientSwitched(Player)' is marked as an override but no suitable method found to override Assets/Photon/PhotonUnityNetworking/Demos/DemoAsteroids/Scripts/Game/AsteroidsGameManager.cs(136,30): error CS0115: `Photon.Pun.Demo.Asteroids.AsteroidsGameManager.OnPlayerLeftRoom(Player)' is marked as an override but no suitable method found to override etc. Initially i tried only photon chat, but also that one gave me errors. I tried adding the package to an empty project and all works great, but I need to add to my existing project. Anyone knows a solution for this? thanks in advance

PUN2 Add/Remove/UpdateCallbackTargets implementation can lead to multiple callbacks

$
0
0
Hello, During my connection sequence, I call AddCallbackTarget and things work - e.g. it's added at the next internal call to UpdateCallbackTarget. During my disconnect sequence I disconnect, then call RemoveCallbackTarget ... but UpdateCallbackTarget is never called as things are basically inactive - so at this point the target is in the remove set, but not removed. Start my connection sequence which includes a call to AddCallbackTarget ... which removes the target from the remove set and adds it to the add set, noting that the target never got removed in an UpdateCallbackTarget call. Thus, at the next UpdateCallbackTarget, the target is added. Thus, each time I disconnect ... then reconnect, I get repeated calls matching the number of times I connected. As a quick fix I modded each of the UpdateCallbackTargets methods in LoadBalancingClient.cs and, int he add loop, gated the add call with a presence check first, ex:
        private void UpdateCallbackTargets()
        {
            if (this.targetsToAdd.Count != 0)
            {
                foreach (IConnectionCallbacks target in this.targetsToAdd)
                {
                    if (!this.Contains(target)) // CHECK ADDED HERE
                    {
                        this.Add(target);
                    }
                }
            }
            ...
Another potential implementation might be to modify the Add/RemoveCallbackTarget methods something like...
	public void AddCallbackTarget(IConnectionCallbacks target)
        {
            bool removed = this.targetsToRemove.Remove(target);

            if (!removed) // Already a target, so don't re-add
            {
                this.targetsToAdd.Add(target);
            }
        }
(Similar/opposite for RemoveCalbackTarget, of course). Note, however, that this second form could fail if client called called RemoveCallbackTarget on a target that was never added, then called AddCallbackTarget on that target before UpdateCallbackTargets was called. Let me know if any further info is needed. Thanks for reviewing, etc. :no_mouth:

Async Turnbased. Error Converting State to type 'Photon.Hive.Plugin.SerializableGameState

$
0
0
Hello, I am using Pun 2 - Free & PlayFab CloudScript to make an async turn-based game. Everything has worked smoothly so far except for loading a room with the serialized (JSON.stringified) state. When loading a new room with the return {"State":"", "ResultCode":0}, the game starts fine and transitions from my Main Menu into the Main Scene. Perfect! I am also able to successfully save the room state on /PathClose to my web server after the EmptyRoomTTL of 12 seconds has passed. I also have set the PlayerTTL = -1 according to the documentation. The errors occurs when a Player attempts to ReJoin a room with the return {"State":data.State, "ResultCode":0} where data.State is the serialized state fetched from a web server. I receive this error in the OnJoinRoomFailed callback. Error converting value data.State to type 'Photon.Hive.Plugin.SerializableGameState'. I am stripping out the DebugInfo property that is passed into the /PathClose webhook before posting to my web server but the error occurs even if I just save the whole State. I can't quite figure out where to go from here! Does anybody have any advice or tips to push me in the right direction? Thanks for your time:)

I updated Pun v2 in unity webstore and i am getting an error. (Failed parsing address: )

$
0
0
i get the full error of. Failed parsing address: UnityEngine.Debug:LogError(Object) Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1848) ExitGames.Client.Photon.IPhotonSocket:Connect() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/IPhotonSocket.cs:113) ExitGames.Client.Photon.SocketUdp:Connect() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/SocketUdp.cs:63) ExitGames.Client.Photon.EnetPeer:Connect(String, String, Object) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:266) ExitGames.Client.Photon.PhotonPeer:Connect(String, String, Object) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1167) Photon.Realtime.LoadBalancingClient:ConnectToGameServer() (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:824) Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2343) ExitGames.Client.Photon.<>c__DisplayClass102_0:b__0() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:894) ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:428) ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1473) Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:116)

Scene object

$
0
0
How to get scene object by non master client for parenting to empty transform.

Region connect issue

$
0
0
Do you have any solution for running the applications in the regions (Qatar, Oman, Syria, Saudi) which are blocking VoIP? Please advise.
Viewing all 8947 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>