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

Player control swapping?

$
0
0
Howdy rather interesting issue I am running into when players enter a room. When the first player enters the room there is no issue he is able to control his local player like you would expect. However, when another player enters the room. the control... swaps. Now Player 1 moves Player 2 and vice versa. Is there anything obvious that I am missing that may be causing this issue to occur? (Oculus VR Platform) private void Start() { Instance = this; if (playerPrefab == null) { Debug.LogError("Missing playerPrefab Reference. Please set it up in GameObject 'Game Manager'", this); } else { if (PlayerManager.LocalPlayerInstance == null) { Debug.LogFormat("We are Instantiating LocalPlayer from {0}", SceneManagerHelper.ActiveSceneName); GameObject Player = PhotonNetwork.Instantiate(playerPrefab.name, new Vector3(0f, 5f, 0f), Quaternion.identity, 0); Player.name = PhotonNetwork.LocalPlayer.NickName; } else { Debug.LogFormat("Ignoring scene load for {0}", SceneManagerHelper.ActiveSceneName); }

Sync loading for every players before spawn in Scene

$
0
0
Hello everyone, I am trying to make synchronous loading so that after number of players in room reach 6 players then the game will go to loading scene before spawning players at same time in arena then start the timer. I wonder how to do that in PUN? Thank you for your help

Illegal view ID method with tutorial punbasics

$
0
0
Hello, I have done the demo punbasics for PUN2 and all I wanted to do is adding a button in the room scenes, when I click it send a rcp call. So I've defined my onclick in the player manager and when I run it, I get the illegal view ID method. I don't get it cause it's in the player manager where rcp call in the update are fine. Could you explain?

Photon VR

$
0
0
Hello everyone, I am doing a multiplayer VR in Unity, I have been able to get most of the stuff correct, however whenever a second player joins, the second player's teleportation is messed up. Whenever it points at a floor and teleports, it moves the character, but not the camera. I use the same prefab from Resources folder to instantiate players, the first player works quite fine however the second player is always messed up. Is there anyone who can help me with this?

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

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)

PhotonView.isMine is broken.

$
0
0
Hi. I've been making a game for my portfolio that I can use for my college interview, and for the past month or so making my game with photon has been great. Until today, everything was running smoothly, until isMine broke down completely. Here's the simple task that uses isMine:
using UnityEngine;

public class PlayerNetwork : Photon.MonoBehaviour {

    [Header("Properties")]
    public PlayerMove playerMove;
    public Rigidbody2D rb;
    public GameObject Aim;
    public PhotonNetworkManager pnm;
    public Transform eyes;
    public PlayerMove move;


    [Header("Network Properties")]
    public bool OfflineMode;

    // Use this for initialization
    void Start ()
    {
        Initialize();
	}

    public void Initialize()
    {
        if (!OfflineMode)
        {
            if (!photonView.isMine)
            {
                playerMove.enabled = false; //playermove is, well, what lets us move
                Aim.SetActive(false); //aim is what lets us aim
                rb.isKinematic = true; //setting our rigidbody to kinematic to avoid any nonsense with the rigidbody
            }
        }

        pnm = GameObject.Find("GameLogic").GetComponent();
    }
}
Incredibly simple. However when I play my game, both of my characters move when I use my arrow keys. So what's going on?

pls help me

$
0
0
problem pun Assets/Photon/PhotonRealtime/Code/PhotonPing.cs(23,27): error CS0101: The namespace `Photon.Realtime' already contains a definition for `PhotonPing' Assets/Photon/PhotonRealtime/Code/PhotonPing.cs(63,18): error CS0101: The namespace `Photon.Realtime' already contains a definition for `PingMono'

Small Problem with PUN package

$
0
0
I opened up Unity today to start working on my level editor and I found that in the console these errors appeared: https://imgur.com/a/zcA46r2 These errors weren't here when I closed down Unity and I don't really know what to do. I deleted and reinstalled all photon folders and the problem continued. Has anyone had any problems with this/has a fix?

Unity .NET 4.6 experimental setting is not supported

$
0
0
Hi Everyone, Just to make sure you don't turn on .NET 4.6 and stick to the stable .NET 3.5 We are getting more and more issues report that actually link back to the use of this experimental .NET 4.6 and at the present time we can't support such projects until Unity turn this feature as stable. If you encounter issues, if you can't reproduce them using .NET 3.5, get in touch with Unity support directly so that they can improve and get closer to a support version. Bye, Jean

High ping PUNBasis

$
0
0
Hello, i have done the PUNBasics demo with PUN2 and i calculate the ping myself: with RCP, i send a call and the 2nd player send me back the call. I get around 100-200 ms and it's very variable. The ping with the EU server is 42ms (written in the log at the launch of the game), being in France. I would like to know if my calculation seems right (according to the EU ping). And also, how can I get this ping better ? But maybe this is normal and there shouldn't be any latency ? Because for now the demo doesn't seem to lag or just a bit but maybe it's because the game is quite simple ? It's very important cause i have to decide if I'm gonna use photon for the game project of my company. (which would rather like to keep a free version).

Traffic optimization

$
0
0
Hello. Does the photon have a limit of 20 GB per CCU per month, is this a real figure that can be achieved in a network shooter for 10 people? We have a network shooter on a small map where it is necessary that all players get the positions of all players. We noticed with the help of photon debugging that the main traffic goes when the characters move. So how can I optimize this? We even lowered the tickrate to 5 times per second (200 ms)

ConnectUsingSettings() works, but ConnectToRegion() does not. (Error ReturnCode 32767)

$
0
0
I've been using PhotonNetwork.ConnectUsingSettings() until recently because I want people from different regions to be able to play with each other. I taker the region from a drop down list, then use that to connect. When I hit the connect button in game I connect just fine if I'm using ConnectUsingSettings(), but if I use ConnectToRegion I get the following error log:
OperationResponse 230: ReturnCode: 32767 (Invalid application id). Parameters: {} Server: NameServer Address: ns.exitgames.com:5058 UnityEngine.Debug:LogError(Object) Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1835) Photon.Realtime.LoadBalancingClient:OnOperationResponse(OperationResponse) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1909) ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:616) ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:545) 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:130)
Here's my code:
//take region from region dropdown list string region = "us"; switch (regionList.value) { case 0: region = "asia"; break; case 1: region = "au"; break; case 2: region = "cae"; break; case 3: region = "eu"; break; case 4: region = "in"; break; case 5: region = "ja"; break; case 6: region = "ru"; break; case 7: region = "sa"; break; case 8: region = "kr"; break; case 9: region = "us"; break; case 10: region = "usw"; break; } PlayerPrefs.SetInt("Region", regionList.value); PhotonNetwork.ConnectToRegion(region);

Server logic for Unity simple game

$
0
0
There is a task: an online 1vs1 pin-pong game where you can bet your in-game currency. There are (for example) 3 game modes with a bet of 5, 20 and 100 coins. The player chooses which bet he wants to play and queues, then the second player queues for the same bet and a room is automatically created for them where they play against each other up to 10 points to win. It is desirable to implement the selection of opponents by skill/experience of the game. So the beginners play with beginners, and experienced with experienced (logic on the server). Again, the rooms should be automatically generated. There should be no lobby with a visible list of rooms, only the choice of a bet and the expectation of an opponent. The winner gets the full bet (without any fee). There must be a database to save the results and settings of each player. Authorization through social networks and email. Protection against cheaters is a low priority. How I planned: All physics and logic takes place on the client side. The server creates rooms for the players that waiting for opponents and provides the exchange of platforms location via UDP, and important messages/events via TCP. There will be no game physics and logic on the server side. This server will be connected to the database to save information, leaderboards and number of collected coins and so on ... Main tasks: C # server for Unity Own logic on the server Ability to work with the database. I wanted to use Photon server for these tasks, but I cannot understand if it is possible to bind a database, for example, MySQL, and process minimal logic on the server, is it possible at all? What server besides Photon is suitable for this project?(preferably free). I will be glad to recieve some help and to find the correct way to solve this problem. Thanks.

OnPhotonInstantiate is not called on SceneObject

$
0
0
Hi. Why OnPhotonInstantiate() is not called on object created by PhotonNetwork.InstantiateSceneObject()?

PhotonNetwork.ConnectUsingSettings of PUN2 that doesn't require the GameVersion is hard to use.

$
0
0
We updated our project from PUN Classic to PUN 2 in reference to the official migration guide. After update, I noticed that we can connect to the same room no matter what network version we set. I found that ConnectUsingSettings() overwrites PhotonNetwork.GameVersion with PhotonServerSettings.AppSettings.AppVersion, Internally. We frequently change GameVersion during development. We set separate GameVersions for each git branch to prevent developers of each feature from being connected to the same room. But AppID is the important value. We don't want to change PhotonServerSettings easily because frequent diffs in git can miss important changes. Why is ConnectUsingSettings (string gameVersion) removed? Are there plans to be reimplemented?

OnPhotonInstantiate callback is not called

$
0
0
I have inherited IPunInstantiateMagicCallback interface eventhough OnPhotonInstantiate callback is not calling ?

Instantiation resource path refactoring hints and tips

$
0
0
Hi! I'm new to PUN and I was quite surprised how prefabs are instantiated. I was used to unity's way of drag & drop a prefab which I can instantiate by just using its field. This makes it much easier when i rename or move an existing prefab. The way photon is doing this (path to resource) is quite tricky, as everytime there happens a change, it will break references. Is there a better way how to manage this in large projects? Any chance to facilitate this with object pooling assets?

PhotonView with ID 1001 has 2 methods "ReducePlayerHealth"

$
0
0
PhotonView with ID 1001 has 2 methods "ReducePlayerHealth" that takes 1 argument(s): Int32. Should be just one? UnityEngine.Debug:LogError(Object) Photon.Pun.PhotonNetwork:ExecuteRpc(Hashtable, Player) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:537) Photon.Pun.PhotonNetwork:RPC(PhotonView, String, RpcTarget, Player, Boolean, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1078) Photon.Pun.PhotonNetwork:RPC(PhotonView, String, RpcTarget, Boolean, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2737) Photon.Pun.PhotonView:RPC(String, RpcTarget, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:410) Dmg_Destroy:Damage(PhotonView) (at Assets/Scripts/Spells/Dmg_Destroy.cs:64) Dmg_Destroy:OnTriggerEnter2D(Collider2D) (at Assets/Scripts/Spells/Dmg_Destroy.cs:119) I know for a fact there is only one method called "ReducePlayerHealth". What is going on with this?

Different machines/devices not seeing other players

$
0
0
Hi, I've an issue where running the same code on two different desktop machines (inside the Unity editor) causes players to connect to different rooms (so they can't see each other). If I build the code and deploy to Oculus Go, I can run one desktop and one Go version and players connect to the same rooms and CAN see each other. Found a few links about connecting to Region but these don't seem to change anything for me. Is there anything else I can check to see why they're not in the same room? Related articles (if Region is the problem); https://forum.photonengine.com/discussion/8390/how-to-let-my-player-to-connect-to-a-region-manually https://forum.photonengine.com/discussion/12542/players-not-joining-already-created-room https://forum.photonengine.com/discussion/comment/41403#Comment_41403 Thanks!
Viewing all 8947 articles
Browse latest View live


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