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

PUN 2 startCommand.fragmentsRemaining was 0 but not all fragments were found to be combined!

$
0
0
I'm having a problem, now the following error message always shows up. Even in previous versions of the project that used to work. I even tried to change the AppID. Any ideas how to fix it?
Exception: startCommand.fragmentsRemaining was 0 but not all fragments were found to be combined! ExitGames.Client.Photon.EnetPeer.ExecuteCommand (ExitGames.Client.Photon.NCommand command) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:1839) ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:413) ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1422) Photon.Pun.PhotonHandler.FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:126)

Disconnected while loading large scenes

$
0
0
Hello, first post here. After upgrading my project from PUN1 to PUN2, I noticed that my smaller scenes load just fine, but my large scene which takes between 10 and 45 seconds to load results in a disconnect on slower machines about 2 seconds after the level is loaded. If the machine loads it quickly, there is no disconnection. Per the Analyzing Disconnects page, the fix for Unity users was to make sure that the PhotonNetwork.IsMessageQueueRunning = false before loading and re-enabling it after. My project already had that code built in and was working just fine on all scenes and machines before the upgrade to PUN2. In other words, that fix is not working on PUN2 for me. After these tests, I'm thinking PUN2 has a regression on this issue. Has anyone else had this problem?

CCU Bots protection.

$
0
0
Hi. I am curious about Photon protection against bots. Lets assume that you have license for 500 CCU, and someone is running 500 bot instances of your game blocking game for human users. Is there any protection for this kind of situations? There could be answer "just don't allow running multiple game instances", but as you probably now, there will be workaround for every simple protection..

Is there a way to select region?

$
0
0
I'm looking through a tutorial on how to do a room browser and that part is all very straight forward but I'd like to see if it's possible to do a drop down menu that gives the players freedom to select which region they want to make a room in. I did some research on this already and apparently there are restrictions on doing this type of thing? Could somebody correct me if I'm wrong or if there's been some kind of change I'd just like to know. Just to be clear, I'm not talking about the server settings, I'm talking about implementing a drop down menu within the actual project.

Client unable to see other players in the same room. Master can however.

$
0
0
I've seen this question asked in a couple of places, and the answer usually seems to be "Make sure to use PhotonNetwork.LoadLevel" and "PhotonNetwork.AutomaticallySyncScene = true" as well as using Photon Network to instantiate. I am doing all of these however, I still cannot see players in the same scene (however objects instantiated after the client joins are visible). The problem: As stated above, when multiple users are in a room, only the master client can see other players and instantiated objects. When the other clients finish loading, they can see the world and newly instantiated objects, but no players or old instantiated objects. The process: When a player presses the "find game" button, they trigger PhotonNetwork.JoinRandomRoom(); and attempt to join a room or create one. A 10 second timer begins. A number of players can join during this 10 second period. After 10 seconds, the room is locked PhotonNetwork.CurrentRoom.IsOpen = false; and the game is loaded PhotonNetwork.LoadLevel(1);. The object persists, and if it's the master client, it spawns enough AIs to equal 10 (everything is instantiated using PhotonNetwork.Instantiate. In addition to spawning AIs, a number of guns are spawned by the MC. When the client's level finishes loading (usually a few seconds later), none of those objects or AIs are visible to the client. However, the objects they spawn (bullets, lasers, etc) appear to the client. The master client can see everything and everyone, including the newly joined clients, leading me to believe that there's some problem with joining players fetching the buffered players and objects created before they joined. Are there any common mistakes that could lead to something like this? I am using PUN V2 which I recently switched to, unsure if there's a problem related to that or not. I am also deploying to WebGL

Adjust ServerSettings at runtime?

$
0
0
My game connects to a central update server at startup, and I would like to be able to adjust any necessary Photon settings via this update server. For example, if Photon Cloud goes down I would like to be able to host my own server and temporarily point all my released games to it.

For some reason, Photon's ServerSettings seem to be stored as static members of a nonstatic serialized ScriptableObject. How do I access and change them at runtime? The code I have:
public static ServerSettings PhotonServerSettings = (ServerSettings)Resources.Load (Path.GetFileNameWithoutExtension (NetworkingPeer.serverSettingsAssetPath), typeof(ServerSettings));
PhotonServerSettings.DefaultMasterPort = 5005;

Results in this error:
error CS0176: Static member `ServerSettings.DefaultMasterPort ' cannot be accessed with an instance reference, qualify it with a type name instead

Manage global score between rooms

$
0
0
Hi, there. I'm making a simple game, throwing balls in a bucket and score points. In each room's max player count is 10. There will be several rooms. The problem is that I want to know every player's score in every other rooms but I can't find a way to collect the data. Is there a way to achieve this? Thanks

How do you use OperationResponse in OnWebRpcResponse?

$
0
0
Hello! I'm following along the MemoyGame example and the handling for WebRpc parses the `response.Paramaters` as a `Dictionary`. In PUN, the `Parameters` are a `Dictionary` - how is the `byte` used for keys? I am not sure what data this `byte` is supposed to represent. Could you share an example of how to use this so I can check if the call was something specific, for example "GetGameList`? Thanks in advance!

If one client inside the room disconnected, the other clients should be disconnected.

$
0
0
Hi @JohnTube If one client inside the room disconnected, the other clients should be disconnected. Is there any solution?

Connecting to Master Server works in build but not editor.

$
0
0
Iv experience this issue several time once in unity 2018.1 and 2018.2. the editor will work for a period of time then after maybe 2 - 3 hours working, it no longer connects to the master. I then build the game and the built version works and is able to connect. any ideas or suggestions would be greatly appreciated. Have tried. - Fresh install - Host - New Project - Different Versions of unity - restarting router/Modem - Restarting pc - Restarting Unity

Unable to connect more than one client in PhotonSDK Server.

$
0
0
Hello all, I am trying to connect more than one client in my own Photon Server. I ran the PUN Basics (scene name is PunBasics-Launcher) unity demo which works well in PhotonCloud but not in my server. And I am not getting any errors either. Please guide me on how to resolve this.

Object Pool Example

$
0
0
Hi all, I cannot find any proper example of object pooling in PUN when I google. Can you provide me any? Specifically, I do not have any idea what a prefabID is? IPunPrefabPool.Instantiate(string prefabId, Vector3 position, Quaternion rotation)

Does the server or the client initiate connections?

$
0
0
In our institute, UDP is not allowed, only outgoing TCP connections are allowed. That is to say, if we are a client, we can initiate a connection to the server, and from then return traffic is allowed, but the server cannot initiate a connection to our client. I have set the protocol to TCP in PhotonServerSettings, but because it's an inter-institutional application, we want to make sure theoretically it will work before we bother the other side to have a test. So just to confirm, who initiates the connections? From the ports list I see a few ports are used for different server: 843 Flash/Unity Policy (TCP) 4530 Client to Master Server (TCP) 4531 Client to Game Server (TCP) 4533 Client to Name server (TCP) Are they all initiated by the client? Besides, are the events sent using TCP once I set the PhotonServerSettings to TCP? I'm asking because in the RaiseEvent callback it seems we can only set reliable UDP or unreliable UDP. Thanks.

How to keep disconnected players custom properties?

$
0
0
Hello @JohnTube I am going to keep the player's custom property when he exited the application. - Is this possible? - To keep, what can I do? - I only need the player's custom property for about 10 secs. Once I kept the player's custom property, after that can I delete the player's all custom property and the player object itself?

Handling Disconnects

$
0
0
Hello. Our game has the following flow for determining if all players ( between 5 and 8 ) are ready: When each player is ready, they will set a custom property indicating they are ready and the call an rpc which tells all clients to update their loading ui and the master increments a counter of how many players are ready. The master then checks if all players are ready. here is the code:
private void SetupComplete()
    {
        ExitGames.Client.Photon.Hashtable playerProperties = new ExitGames.Client.Photon.Hashtable();
        playerProperties.Add(Strings.PLAYER_LOAD_STATUS, true);
        PhotonNetwork.player.SetCustomProperties(playerProperties);
        photonView.RPC("RemoteCallForSetupComplete", PhotonTargets.AllBufferedViaServer);
    }

 [PunRPC]
    public void RemoteCallForSetupComplete()
    {
        //add call here to update player loading tabs
        if (LoadingScreen.GetInstance() != null)
        {
            LoadingScreen.GetInstance().UpdatePlayerLoadingTabs();
        }
        if (PhotonNetwork.isMasterClient)
        {
            ++playerSyncCount;
            if (PhotonNetwork.offlineMode || (playerSyncCount >= PhotonNetwork.playerList.Length))
                photonView.RPC("SetupCompleteForEveryOne", PhotonTargets.AllBufferedViaServer);
        }
} This code works fine. However we need to handle the situation where a player disconnects. To do that we use the OnPhotonPlayerDisconnected callback. From OnPhotonPlayerDisconnected, the master client calls the following function to check if all players are now ready as the disconnecting player may have been the only one we were waiting for:
public void MasterCheckSetupCompleteAfterPlayerDisconnect()
    {

        if (LoadingScreen.GetInstance() != null)
        {
            LoadingScreen.GetInstance().UpdatePlayerLoadingTabs();
        }

        Debug.LogError("Player count : " + playerSyncCount + " actual count " + PhotonNetwork.playerList.Length);

        if (PhotonNetwork.offlineMode || (playerSyncCount >= PhotonNetwork.playerList.Length))
            photonView.RPC("SetupCompleteForEveryOne", PhotonTargets.AllBufferedViaServer);
    }
Here is the issue. What if the player who disconnected has already completed setup? In this case I should decrement the playerSyncCount. The issue is I am not 100% sure what the best way to do that is. Here are possibilities 1) I check the Strings.PLAYER_LOAD_STATUS for the disconnecting player to see if it is true. This seems like a good idea. I just wonder if there might be an edge case where this won't have updated right after the player disconnects? 2) Modify the code, so the master client doesn't rely on an rpc call to indicate players are done loading, and rather periodically check the player properties hash table to compare number of players with loaded players Please advise

How to get the ping value ?

$
0
0
Hello,

I compute my ping like that : ping = peer.RoundTripTime/2; but It seems that it does not take the jitter in that value.
How can I compute the ping in an efficient way ?

Thank you very much.

Vfx on impact of a raycast??

$
0
0
Hi, I've got a working shooting script that works with a health script on each character so that players loose health points when hit by the raycast, and if you shoot at the water in my scene there's a water splash effect that instantiates where the ray hits, but the water splash only occurs locally and is not visible to other players. What do I need to do to my code specifically, to make the instantiated water splash visible to all players in the scene? The water splash prefab has a photonView script on it: (); if (weaponData == null) { weaponData = gameObject.GetComponentInChildren(); if (weaponData == null) { Debug.LogError("Did not find a WeaponData script on child object"); } return; } if (cooldown > 0) { return; } //Ray ray = new Ray(Camera.main.transform.position, Camera.main.transform.forward ); Ray ray = new Ray(cam.transform.position, cam.transform.forward); Transform hitTransform; Vector3 hitPoint; //if (Physics.Raycast(ray, out hitInfo)) //{ // Debug.Log("We hit: " + hitInfo.collider.name); //} hitTransform = FindClosestHitObject(ray, out hitPoint); if (hitTransform != null) { Debug.Log("We hit: " + hitTransform.name); // we could do a FX animation on the hit location // DoSmokeEffect (hitInfo.point); if (hitTransform.gameObject.tag == "waterEx") { GameObject impactGO = Instantiate(impactEffectwater, hitPoint, transform.rotation); Destroy(impactGO, 1f); }">

PUN 2

$
0
0
PUN 2 As of now, PUN 2 is in the Asset Store. There are two packages (free and plus) which contain the same content, so everyone can just get and use the Free package. Upgrading PUN 1.xy Plus to PUN 2 can be done with PUN 2 Free. Get the Plus package only, if you use PUN 2 Free already and want to get a 100 CCU subscription for a one time fee. What's new?! PUN 2 has a new structure and comes in just one "root" folder. We cleaned up the naming of many classes, fields and interfaces and there is a new callback system. We created new demos and are in the process of re-writing the documentation (note the v2 in the link). Currently the API reference is only in the package (see the PDF or CHM files). Updating existing projects will be quite some work. Here are the migration notes we took. Existing subscriptions (e.g. of a previously purchased PUN Plus) can be used with PUN 2. There is no upgrade fee or such! If you got an existing 100 CCU subscription, you can use that. Existing AppIDs can be used in PUN 2 (and vice versa). Why a second package then?! PUN 2 wraps up a lot of internal refactoring and includes multiple breaking changes for existing PUN projects. As we don't want to break existing projects, PUN 2 got separate packages. Should I update? Bigger or almost complete projects should probably stick with PUN "Classic". We will keep that package around and update it but we probably won't add more features. Projects starting recently or soon, should use PUN 2. Something is broken, right?! We tested PUN 2 in early access and with our demos but of course, there can be bugs. When reporting issues in PUN 2, please make sure to tell us you're using PUN 2 already. Reply here or mail to: developer@photonengine.com. Or post in this forum! Why no upgrade for PUN 1 Plus?! We were unsure if we could still update the old package when we setup an upgrade path in the Asset Store. What's more important: After using the Upgrade, you would not be able to get PUN 1 Plus anymore, updated or not. So we keep things separate for the time being. Hope you all enjoy!

How to get photon player transform

$
0
0
Hello, I'm trying to make a void that returns the player transform by the passed "UserID" when its called, Any ideas how to achieve that? i did this but i don't have any idea about how to get the transform
    public Player GetPlayer(string playerID) {
        foreach (PhotonPlayer player in PhotonNetwork.playerList) {
                if (player.UserId == playerID)
                {
                    Debug.Log("User with playerID of " + playerID + " is found and his name is " + player.NickName);
                    //RETURN PLAYER CLASS ->  return transform.GetComponent();
            }
        }
    }

Change Image Sprite

$
0
0
Hello! I have a problem, I can not program an image to change sprite. For the text is easy, you write : textPlayer.text = PhotonNetwork.PlayerList[1].NickName; but how to change the sprite of an image is more complicated. How do I make each image belong to a player and change the color with some variable? Help me please... It's not that I do not know anything, it's that I do not understand, I've done the player, the lobby, the room, I've also named the player. but I want to put the image and I do not know how to do it.
Viewing all 8947 articles
Browse latest View live


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