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

PUN for WebGL build error : Deserialization failed for internal Operation Response. System.Exception

$
0
0
My project was working fine while on Android platform. I switched to WebGL platform for HTML5. Protocol is set to Web I tried to connect to Photon Network. Can any one suggest how to fix this?
Deserialization failed for internal Operation Response. System.Exception: Deserialize(): 7 pos: 6 bytes: 55. F3-07-01-FF-FF-07-2F-4D-69-73-73-69-6E-67-20-76-61-6C-75-65-20-31-20-28-50-69-6E-67-52-65-71-75-65-73-74-2E-43-6C-69-65-6E-74-54-69-6D-65-53-74-61-6D-70-29-0D-0A-00
  at ExitGames.Client.Photon.Protocol16.Deserialize (ExitGames.Client.Photon.StreamBuffer din, System.Byte type) [0x0021b] in <7c99d57ff1b84df1ab45b8023b1063e2>:0 
  at ExitGames.Client.Photon.Protocol16.DeserializeOperationResponse (ExitGames.Client.Photon.StreamBuffer stream) [0x0002b] in <7c99d57ff1b84df1ab45b8023b1063e2>:0 
  at ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) [0x0030d] in <7c99d57ff1b84df1ab45b8023b1063e2>:0 
UnityEngine.Debug:LogError(Object)
NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1620)
ExitGames.Client.Photon.<>c__DisplayClass104_0:<EnqueueDebugReturn>b__0()
ExitGames.Client.Photon.TPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:161)

IPv6 for Unity iOS Exports

$
0
0
Apple now requires iOS apps to support pure IPv6 connections. We tested PUN v1.75 and it supports IPv6, including the "Best Region" setting. If you use the Photon Cloud, you only have to make sure your PUN version is up to date. If you run a Photon Server, you need to use a recent 4.x server.

Test All Builds

Unity's support for IPv6 begins with 5.3.4p4. They posted about adding IPv6 support. Several versions of Unity do not successfully support IPv6, so you should test each build. If you get a client-side error like this, your client needs an update; Connect() to 'x.x.x.x' failed: System.Net.Sockets.SocketException: Network is unreachable in a IPv6 network.

Test Procedure

Read "Test for IPv6 DNS64/NAT64 Compatibility Regularly" to learn how to test IPv6 support easily. We do this for PUN before release. Make sure there is not some other plugin failing!

Handling Rejections

We know that some apps got rejected, despite using PUN v1.75 or newer. If your app gets rejected, please get in touch with the Apple review team. Point out that you're using PUN and that we and you both tested the networkcode versus their own test procedures. Explicitly point to their own test-description page. Apple suggests:
If the iOS application is successful in working across the macOS NAT64 test environment, then the next step is to submit a bug report. We ask developers to use the Apple Developer Bug Report web page - http://bugreport.apple.com to submit the bug report. The bug report is to indicate that there is some compatibility issue between the app and the App Review test environment. In the bug report, the developer provides evidence that the iOS application worked successfully across the macOS NAT64 test environment by including a packet trace to show the success of the connection process. Note that the bug report is not an indication as to where the problem lies, but the fact that the iOS app works in the test environment and not in App Review is an indication that the app / App Review interaction needs further review. Once the bug report is submitted, there issue is then assigned to investigation by an App Review group. Once a bug report is assigned to App Review, the next thing is to follow up with the bug report by communication with App Review - “appreview@apple.com”. While the email inquiries may not always get a response - all of the correspondence is viewed.

Cloud and Server

The Photon Cloud can not provide public IPv6 addresses in the short term. However, Apple's requirement is only that clients can cope with IPv6 addresses in their network, if that provides "IP translation", as described in their article. For anyone using Photon Server (OnPremise), this means, you can likely continue to run it as IPv4 service. If you want to setup a true IPv6 server, we have some docs for that. Get Photon Unity Networking in the Asset Store.

Photon Upgrade Subscription

$
0
0
We have some questions regarding upgrading our subscription.
We are currently in 500CCU, this was subscribed on 5th August 2020.
We are now planning on upgrading to 2000CCU with the discount of 500CCU.
Is that a possibility? As otherwise will the 500CCU stack up with 2000CCU?
It would be highly appreciated if someone could assist us with this.

How to build AI logic in PUN (Like a Boss AI)

$
0
0
like the title, How to build AI Logic in PUN?
I guess let one client to control the AI, But If this client is logout, The AI is gone too (Like a Boss).
So , how to prevent that (is very common that player logout frequently in Mobile device)

Is there a way to be notified when ConnectToRegionMaster fails?

$
0
0
Hi, Is there a way to get notified if LoadBalancingClient.ConnectToMasterServer() fails (e.g. due to connection issues)?

Absolutely beginner | photonview.ismine - Object reference not set to an instance of an object

$
0
0
My game was playing without any error on single player, then i decided to go hard and build my game as multiplayer.

I will try to explain what happens at the moment:

I have one prefab called Player and it instantiate fine. I would need to control almost everything assigned to the player in photon too, such as ammo, rifle, health, Canvas, armor, movement, mouse movement, shoot etc etc.

So i start with weapons. here is my code below; when game starts i dont get an error, but if i activate weapon im getting error message. Where ever i add photonview.ismine i am getting an error, surely i am not doing it right, however i dont know how to make it right too...

can anyone help me to understand how to set it up? thanks
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class WeaponSwitch : MonoBehaviourPunCallbacks
{
    [SerializeField] int currentWeapon = 0;
    private PhotonView PV;
    void Start()
    {
        SetWeaponActive();
        PV = GetComponent<PhotonView>();
    }

  
    public void Update()
    {
        int previousWeapon = currentWeapon;
        ProcessKeyInput();
        ProcessScrollWheel();

        if(previousWeapon != currentWeapon)
        {
            SetWeaponActive();
        }

       

    }

    public void ProcessScrollWheel()
    {
        if (Input.GetAxis("Mouse ScrollWheel") < 0 && PV.IsMine)
        {
            if (currentWeapon >= transform.childCount - 1)
            {
                currentWeapon--;
            }
            else
            {
                currentWeapon++;
            }

        }

        if (Input.GetAxis("Mouse ScrollWheel") > 0 && PV.IsMine)
        {
            if (currentWeapon <= 0)
            {
                currentWeapon = transform.childCount - 1;
            }
            else
            {
                currentWeapon--;
            }
        }
    }

    public void ProcessKeyInput()
    {
        if(Input.GetKeyDown(KeyCode.Alpha1) && PV.IsMine)
        {
            currentWeapon = 1;
        }

        if (Input.GetKeyDown(KeyCode.Alpha2) && PV.IsMine)
        {
            currentWeapon = 2;
        }
        if (Input.GetKeyDown(KeyCode.Alpha3) && PV.IsMine)
        {
            currentWeapon = 3;
        }
        if (Input.GetKeyDown(KeyCode.G) && PV.IsMine)
        {
            currentWeapon = 4;
        }
        if (Input.GetKeyDown(KeyCode.Alpha4) && PV.IsMine)
        {
            currentWeapon = 4;
        }
        if (Input.GetKeyDown(KeyCode.Alpha5) && PV.IsMine)
        {
            currentWeapon = 5;
        }
        if (Input.GetKeyDown(KeyCode.Alpha6) && PV.IsMine)
        {
            currentWeapon = 6;
        }
    }

    public void SetWeaponActive()
    {
        int weaponIndex = 0;
        foreach (Transform weapon in transform)
        {

            if(weaponIndex == currentWeapon)
            {
                weapon.gameObject.SetActive(true);
            }
            else { weapon.gameObject.SetActive(false); }

            weaponIndex++;
        }
    }
}

PUN 2.20.2 is broken!

$
0
0
I have PUN 2.18.1 and when i update to the last version 2.20.2 the online scene (when the "start match" button is pressed) is not loaded for the guest. I tried to create a new project with Photon assets only and i have the same issue for the Asteroids demo. The Host loads the scene but the guest don't.

Am I supposed to connect both PhotonNetwork and LoadBalancingClient?

$
0
0
So I call LoadBalancingClient.ConnectToRegionMaster() to connect and to do calls like OpFindFriends() while outside a room so I can get their online status, am I supposed to call PhotonNetwork.ConnectUsingSettings() as well? And should I call PhotonNetwork.JoinRoom() etc. or are those calls supposed to go through the LoadBalancingClient I've created?

PunTurnManager issue

$
0
0
Hey all,

apparently command BeginTurn() doesn't work for me.
public PunTurnManager turnManager;

void Start()
    {
        PV = GetComponent<PhotonView>();

        inputEnabled = false;
        this.turnManager = this.gameObject.AddComponent<PunTurnManager>();
        this.turnManager.TurnManagerListener = this;
        
        // duration of the turn
        turnManager.TurnDuration = 10f;

        if (RoomController.roomController.isGameLoaded)
        {
            GameBegins();
        }
    }

public void GameBegins()
    {
        Debug.Log("Game Started.");
        Debug.Log("Turn " + turnManager.Turn);
        if (PhotonNetwork.IsMasterClient)
        {
            turnManager.BeginTurn();
            Debug.Log(PhotonNetwork.CurrentRoom.GetTurn());
         }
    }
Last log results with "0"

What am i doing wrong?

Oculus PUN VR (Master sees other players frozen, Clients sees master working properly)

$
0
0
I am still new to Photon and PUN, and sorry if I missed something out, still figuring things out.
I'm using PhotonNetwork.LoadLevel" and "PhotonNetwork.AutomaticallySyncScene = true" in my project, I see those mentioned in other posts.
OVRPrefab is always persistant in laucher scene, and it is not instantiated in room, only network avatar.
So when Master create a room(CreateRandomRoom), and client joins, master see client frozen and not updating it's transform values, while client sees master perfactly fine moving and updating values.

I stuck on this for while now, does anyone have a clue or suggestions?
Are there any common mistakes that could lead to something like this?

RequestOwnership of hierarchy of PhotonViews?

$
0
0
Hi all,

I am making a game where players can grab objects, carry them around, and put them back on the table for example. this is working fine so far, I request ownership, parent the object to the player, and the PhotonView in syncing the movement to everyone.

Now I have hierarchical objects for example a safe and the safe contains three valuable coins. Those can be grabbed once the safe is open, too. So they need a PhotonView as well. So if one player picks up the safe, the position of it and the coins get synced. Fine.

But since the safe and coins send individual updates they arrive at slightly different times and with fast movements the coins may even step outside the safe for a moment. So I thought, why not just send the safe update, disable the child Views, and let the parent (safe) move the children (coins) at the client. This would look better and also save unnecessary updates.

Sadly if someone who requests ownership of the safe and the coins, which are four requests in total, something goes wrong and the coins may end up in the air above the save. I tried to figure out what happens when exactly but with all updates and lag I can only guess, that the grabbing player starts sending position updates for the safe and the original owner just received one of the ownership requests e.g. the safe but not for the coins yet etc.

Long story short: how can I handle this situation best? I wanted to try to send only an ownership request for the parent and the receiving owner would transfer his ownership for the children in one step but the code for this internal events seems to be in a dll.

One solution I can think about is to deactivate all PhotonViews (or PhotonTransformView to be precise) on child objects that have a PhotonView on the parent at the start of the game and activate them if a child gets grabbed by a player and unparent it so it becomes a self-contained object.

Thanks for reading so far and for any advice :)

Please Update PUN tutorials

$
0
0
I have been studying the tutorials, and I'm having trouble to follow the code, because some lines are deprecated, and there is no exact info about how to input an updated code.

Some examples:
Application.LoadLevelName (in other codes appears as SceneManagerHelper.ActiveSceneName)

void OnSceneLoaded(UnityEngine.SceneManagement.Scene scene, UnityEngine.SceneManagement.LoadSceneMode loadingMode)
{
this.CalledOnLevelWasLoaded(scene.buildIndex);
}

I don't know if OnSceneLoaded is a Unity built-in method... It would be good if you clarify it in a comment.

Thanks for your collaboration.

Get SceneObject by GameObject name

$
0
0
I have tried and searchd for a few days now and dont really know what I am doing wrong.

Ultimately, I just want to be able to have an Object that is synct between different players, that is only once available in the scene, and can be turn visible/invisible for each player seperately.

I have a Prefab which I initialise a SceneObject using PhotonNetwork.InstantiateSceneObject
On the Master the Object gets initialised perfectly as well as the clients can see the object. The Object has a collider and when the user (in VR) touches it, they request ownership and can interact (move) the object. This works perfectly fine.

Now this object needs to be set active (GameObject.SetActive(false)) at Start as this should not be visible at game start. Currently my script accesses the GameObject by name and changes the SetActive flag which works perfectly fine for the master, but the clients cannot find the gameobject by name and return null, even though the gameobject appears in the unity editor hirachie and i can manually tick the active flag. I have now also tried to get a list of instantiated objects using:
public class Options:MonoBehaviour {
        private GameObject optionPKW;
        private bool optionsPKWOnOff = false;
        
        void Start(){
            PhotonView[] pv = PhotonNetwork.PhotonViews;
            foreach(PhotonView p in pv) {
                Debug.Log(p.ViewID);
                Debug.Log(PhotonView.Find(p.ViewID).gameObject.name);
                Debug.Log(p.IsMine);
                if(PhotonView.Find(p.ViewID).gameObject.name == "PWRessource(Clone)") {
                    optionPKW = PhotonView.Find(p.ViewID).gameObject;
                    }
                }
            optionPKW .SetActive(false);
            }
}
which returns a list of all objects with their IDs, GameObject names and ownership. However this only works again on the master, performing the request from a client (second person logging on the server) does not return any photonviews at all.

Anybody any help? I really just want to that what you can in the unity editor and turn an object on or off an object of which i just know the name.

Thank you very much already in advance.

How to connect to your friend room in pun 2?

$
0
0
Hi guys I am using pun 2 as you can tell from the title and I want to ask how can I join to my friend party?
I have a list of my friends but I do not know how to do it pls help I am stuck on it a lot of time. I know there is a thing that called expected players and I check the Matchmaking Guide. didn't understand it ):

Build created on remote build agent is not finding appId

$
0
0
Hello all! Im using PUN and when creating a build locally i can connect as well as running in the editor. Both can connect to the same room and all this works. However, I am building my project on a remote build agent. The build agent fetches the code from source control, and creates a build based out of this. The build works, except that i can't connect to the Photon servers, with the following error being thrown: "The appId this client sent is unknown on the server (Cloud). Check settings. If using the Cloud, check account." I believe this is because the build did not include the appId which is configured in the PhotonServerSettings file. Anyone has any idea why this might be? I can see my appId sitting in the PhotonServerSettings file in Source Control, so it is available there, just not picked up on build. Thanks in advance for any help!

Set Network interface Card Preference on v4?

$
0
0
I'm using v4.029 to network and run a game between a local computer tower and an AR device. It has two network interface cards in it-- one ethernet and one WiFi. The ethernet is set to a static IP while the WiFi is dynamic. Disabling the ethernet allows the app to work perfectly. However, having both cards enabled does not allows the AR device to connect-- I'm assuming the server is being instantiated on the Ethernet card instead of the WiFi card.

How can I control which NIC the server is started on?

InvalidCastException: Specified cast is not valid. Photon.Pun.PhotonRigidbodyView.OnPhotonSerializeV

$
0
0
InvalidCastException: Specified cast is not valid.
Photon.Pun.PhotonRigidbodyView.OnPhotonSerializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at D:/unity/BadBoysModefy/Assets/Photon/PhotonUnityNetworking/Code/Views/PhotonRigidbodyView.cs:76)

RPC calls being remapped to other rpc calls?

$
0
0
When calling the "TakeDamage" RPC on one of the player , it calls another RPC instead. Does anyone else have the same issue? I did override my project with my repository of a previous version which i'm thinking is the main problem behind it.

Photon WebGL error UriFormatException: Invalid URI: The URI scheme is not valid.

$
0
0
Hi! i am using photon pun 2 unity version 2019.2.12. work fine on standalone platform but when i am switch to WebGL show error and not connect.
UriFormatException: Invalid URI: The URI scheme is not valid.
System.Uri.CreateThis (System.String uri, System.Boolean dontEscape, System.UriKind uriKind) (at <fb35542c49c94f4d9bf912c73e79fe13>:0)
System.Uri..ctor (System.String uriString) (at <fb35542c49c94f4d9bf912c73e79fe13>:0)
ExitGames.Client.Photon.SocketWebTcp.Connect () (at Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs:93)
ExitGames.Client.Photon.TPeer.Connect (System.String serverAddress, System.String proxyServerAddress, System.String appID, System.Object customData) (at <a497a6f18e1f4b419421b940add27a6e>:0)

Cannot connect to one room

$
0
0
The room settings are the same, why every time when there is already a created room, the player does not connect there, and creates a new one?
public void StartMatchMaking(){
        Debug.LogError(CreateRoomProperties());
        PhotonNetwork.JoinRandomRoom(CreateRoomProperties(), 4);
    }

    ExitGames.Client.Photon.Hashtable CreateRoomProperties()
    {
        return new ExitGames.Client.Photon.Hashtable
        {
            {"bet", bet}
        };
    }

    private void OnPhotonRandomJoinFailed(object[] codeAndMsg)
    {
        CreateRoom();
    }

    public void CreateRoom(){
        ExitGames.Client.Photon.Hashtable ht = new ExitGames.Client.Photon.Hashtable();
        RoomOptions ro = new RoomOptions();
        ht.Add("bet", bet);
        ro.CustomRoomProperties = ht;
        Debug.LogError(ro.CustomRoomProperties);
        PhotonNetwork.CreateRoom(""+PhotonNetwork.player.NickName, ro, TypedLobby.Default);
    }

    void OnPhotonPlayerConnected(PhotonPlayer otherPlayer)
    {
        Debug.Log("New player: " + otherPlayer.NickName);
    }
Viewing all 8947 articles
Browse latest View live


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