How can I diagnose a crash thats happening only on the built version? I've had 0 errors on the editor itself, hosting/joining/creating. However pretty frequently my built version freezes up and crashes on loading (creating/joining). Right now i have basic steam auth and pun2
↧
Running Editor + Built Version (Sometimes) crashing on join/create
↧
How can i get a room's data by name?
I can't seem to find a function to grab a rooms data by name(for example player count) from what I see there is a GetRoom() in pun classic but maybe not in the new pun?(sorry if this is wrong place and sorry if I said this all wrong)
↧
↧
RaiseEvent suddenly broken after switching to Hashtables and RemoveFromRoomCache (Worked once)
So as the title says, I switched to hashtables in my customData for RaiseEvent, because there are some events I want to cache, and specific events I want to remove from cache (and not all - therefore the hashtable to filter just events with specific data).
I have experienced the following TWICE so far (I reverted all my code to a working commit using object[]) and started over between):
Using RaiseEvent with object[[] works fine. (Sending 1 Vector3 position and a couple ints for enums).
Debug.Log within OnEvent() just to be sure the events are being received, they are; correct byte codes, right data.
Debug.Log the bool generated by RaiseEvent() too just to be sure.
AddToRoomCacheGlobal works fine.
Refactor the data to use a Hashtable.
Works fine! Positions come through (this is infrequent, once per 1-2 seconds roughly). Enums are being set correctly.
Debug.Log within OnEvent() just to be sure the events are being received, they are; correct byte codes, right data.
Debug.Log the bool generated by RaiseEvent() too just to be sure.
Next, I decided to try firing my first RemoveFromRoomCache event with the Hashtable filter.
The position was not being received on the other client suddenly. Nor were the enums updating.
"Hmm" I thought. Maybe I'm firing the RemoveFromRoomCache too close to the RaiseEvent() with the new data (even though I'm using Reliable) and it's getting removed before it comes through.
So I take out JUST the RemoveFromRoomCache event. Changed NOTHING ELSE. Everything is back to _exactly_ the way it was when Hashtables were working.
Now broken. Nothing is coming through.
Debug.Log within OnEvent() just to be sure the events are being received, they are NOT. Only Photon (200 +) codes are coming through.
Debug.Log the bool generated by RaiseEvent() - the bool is still true - so don't know what's happening.
Can I get some feedback on this problem?
I've reverted to object[] data and it works again, and then gone through this process twice with same results.
↧
Exception: cannot serialize(): UnityEngine.RaycastHit
Hello, how i can serialize RaycastHit?
↧
Increase send interval for specific PhotonView object?
Hi! I have a multiuser pen drawing app where the pen object's position and rotation are observed and synced around the room. However, the sync frequency is too low for it to produce proper representations of the drawings. Before I go into sending actual line data (which is what I'll probably do later), I wanted to try increase the send frequency per second on that PhotonView -- is there a way to do that? Thanks!
↧
↧
PUN2 Add/Remove/UpdateCallbackTargets implementation can lead to multiple callbacks
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:
↧
rigidbody works only in master client
Hello,
I made a 2D multiplayer ball game with Photon and Unity (max 2 players in one Room). The offline part is 100% working. But in the online part, only the Master client can interrect with the ball correctly but the other player can not interrect with the ball, to better detail: only in the Master's device the rigiditbody works well, but the movements of displacement two players work well. Please, I need a help, and a solution.
↧
Players can't shoot eachother?
Hey guys! So, I've been working with PUN for a while now, but whatever I do, I can't seem to get shooting to work. The problem is (by the title) that players can't shoot each other, and I have no idea why! But all I DO know is this: When a player shoots, they do detect shooting other players. When the player shoots another player, it get's a script on the other player and calls a function that deals damage to that player. Well, I use getComponent to get that script, but when I shoot, the GetComponent doesn't go through! In other words, for some reason I can't access the script! Here's my code to do the damage on the local player: https://paste.myst.rs/70m And my code to take damage on the other players: https://paste.myst.rs/vvw Any help would MUCH appreciated. Thanks!
↧
Disconnected at room...
Hello! I have a problem connecting to PhotonRealtime. after I create a room and go there, it throws me out in the lobby in about a minute. I thought that the problem was with my code, but the same situation in the demo scene
↧
↧
Why Does photon Pun 2 only work locally on my computer and not on another computer?
I had it working at one point with it connecting to the server on two different computers. Then I upgraded to Photon Pun 2 and migrated everything over. it says it's connecting but on the photon public cloud, under my applications, it is showing that there have been 0 CCU even though it lets me connect locally. I'm using PhotonNetwork.ConnectUsingSetting() but I'm not really sure if it's working like it's supposed to. Before I switched to PUN 2, it would show CCU in real time on the website and showed accurate analytics. What could be causing this problem?
↧
Pass ownership on disconnect.
Hey everyone.
So my question is when a player disconnects, is there a way for the master to automatically take ownership of an object rather than the object being destroyed.
The issue I'm facing is all Owner objects destroy when the player leaves.
If I instantiate as a scene object, then only the master can control the object though that's not always the player.
The only way I can see it working with the Master client is if I set up RPCs for every little thing. Which I don't want to do.
For now, I'll leave as it but I hope someone has an answer :)
↧
How to detect collision ?
Hi,
I am new to photon, And I've spent the last two weeks trying to make a very simple 2d shooter (like diep.io), Now I'm in the shooting phase :smile: , I've made the shooting mechanics using RPCs but I don't know how to detect collision, scince there's a bit of lag that make the OnTriggerEnter2D useless, How can I detect the triggers ? Should I only detect them on the master? and if that's the only solution is there someway to choose the master manually (to make sure the master has a good internet speed and ping etc...)
Thanks in advance,
↧
photon wont connect
im using unity 2018.3.14f and pun 2. On connection, photon will get stuck at connectingtonameserver and nothing will happen afterwards, no connection is made... I have reinstalled photon, restarted computer, editor nothing is helping, its weird because this problem literally came out of nowhere and haven't been able to make progress.. Thank u!
this is my networking code that has worked before:
public static NB_Networking Instance;
[SerializeField] protected string Version = "0.1";
[SerializeField] protected GameObject Player = null;
private void Awake()
{
Instance = this;
DontDestroyOnLoad(gameObject);
ConnectToPhoton();
}
private void Update()
{
Debug.Log(PhotonNetwork.NetworkClientState);
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
}
protected virtual void ConnectToPhoton()
{
if((PhotonNetwork.IsConnected) || (PhotonNetwork.IsConnectedAndReady))
{
Debug.Log("Already connection to photon, returning so we dont reset our conection");
return;
}
try
{
PhotonNetwork.ConnectUsingSettings();
Debug.Log("Attemping Connection...");
}
catch
{
Debug.LogError("Couldn't connect to Photon Network");
}
}
public override void OnConnected()
{
base.OnConnected();
Debug.Log("cc");
}
public override void OnDisconnected(DisconnectCause cause)
{
base.OnDisconnected(cause);
Debug.Log(cause);
}
public override void OnConnectedToMaster()
{
Debug.Log("Succesfully connected to master");
PhotonNetwork.LocalPlayer.NickName = "Player " + Random.Range(0, 1000);
PhotonNetwork.JoinLobby();
}
public override void OnJoinedLobby()
{
base.OnJoinedLobby();
Debug.Log("Succesfully connected to lobby");
RoomOptions RoomOptions = new RoomOptions();
RoomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable();
RoomOptions.CustomRoomProperties.Add("BlueScore", 0);
RoomOptions.CustomRoomProperties.Add("RedScore", 0);
PhotonNetwork.JoinOrCreateRoom("New Room", RoomOptions, null);
}
public override void OnJoinedRoom()
{
base.OnJoinedRoom();
Debug.Log("Succesfully joined room");
SpawnPlayer();
}
public void SpawnPlayer()
{
PhotonNetwork.Instantiate(Player.name, NB_Game.Instance.GetSpawnPoint().position, NB_Game.Instance.GetSpawnPoint().rotation, 0);
}
↧
↧
BUG PhotonView has no method marked with the [PunRPC](C#) property! Args: Int32
everything worked well for some time
anyone has any solution how to fix it and how is photonView
spat out the error?
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.GetComponent() != null)
{
if (!Network.IsOffline())
{
if (other.gameObject.GetComponent() != null)
{
other.gameObject.GetComponent().RPC("RPC_Obrarzenia", RpcTarget.All, Damage);
}
}
else
{
other.gameObject.GetComponent().RPC_Obrarzenia(Damage);
}
}
if (!other.isTrigger)
{
Network.Destroy(gameObject, true);
}
}
public class Zdrowie : MonoBehaviourPun,IPunObservable {
//~100 code line
[PunRPC]
public void RPC_Obrarzenia(int value)
{
zdrowie -= value;
}
}
↧
Can i use unlimited server in Unity ?
Hi,
Iam working on a game in Unity engien , and i want to know if i can use unlimited server ( that cost 175$/month ) in unity and if i can , it will be the same codes or different? and how can i active this server in my project ?
Iam working on a game in Unity engien , and i want to know if i can use unlimited server ( that cost 175$/month ) in unity and if i can , it will be the same codes or different? and how can i active this server in my project ?
↧
Build Android project
is there any way to make my apk run under background .
i made a chatting rooms .... But
photonview , all connection . talking and chatting sound , all that gone if the app is on background .
i tried to use Anbdroid Studio and Edit this file "UnityPlayerActivity.java commenting out the calling on the Pause . but it did not work .
please ? I worked 3 months on this project and here is this problem can't find any way to solve it . I can't understand why unity team did not provide any script for this .
i made a chatting rooms .... But
photonview , all connection . talking and chatting sound , all that gone if the app is on background .
i tried to use Anbdroid Studio and Edit this file "UnityPlayerActivity.java commenting out the calling on the Pause . but it did not work .
please ? I worked 3 months on this project and here is this problem can't find any way to solve it . I can't understand why unity team did not provide any script for this .
↧
How to Fix connect with Master server?
Hi ,
Iam sufer from this problem
("Connect() to 'ns.exitgames.com' () failed: System.Net.Sockets.SocketException (0x80004005): Could not resolve host 'ns.exitgames.com'
")
This problem appear when i trying to connect with master server with code : PhotonNetwork.ConnectUseingSettings
Iam using Photon PUN2 - free
Unity 2019.1.4
Please help me
Iam sufer from this problem
("Connect() to 'ns.exitgames.com' () failed: System.Net.Sockets.SocketException (0x80004005): Could not resolve host 'ns.exitgames.com'
")
This problem appear when i trying to connect with master server with code : PhotonNetwork.ConnectUseingSettings
Iam using Photon PUN2 - free
Unity 2019.1.4
Please help me
↧
↧
PhotonNetwork.isMessageQueueRunning and SetRoomCustomProperties
Hi,
I am using in my project PhotonNetwork.isMessageQueueRunning = false in order not to receive RPC before my client I ready to game. But if other client is setting values to CustomProperties of the room, the value is not sync between players.
if I have PhotonNetwork.isMessageQueueRunning = true, everything seems to works just fine. Is it possible, or I am doing something wrong?
↧
SceneObjects able to be written to by client?
So I have been stuck for the last couple days trying to create a simple pickup system in a multiplayer game, where when one player picks up an object it will be marked as active, and PhotonTransformView will now broadcast to all clients where the player is taking the object. It works smoothly if a client watches a host pick up an object, but it seems that when a client picks up an object, it is not written through OnSerializeView to the host/other clients.
What would be a way to work around this problem, I feel like many games implement systems similar but I have had trouble researching how this could be done through Photon.
Thanks!
↧
Can't connect (clientTimeout)
I'm sure there's something ridiculously simple that I'm missing which I'm going to beat myself over afterwards, but I can't for the life of me figure out why I can't connect to Photon Cloud on my game. I get the clientTimeout DisconnectCause from the OnDisconnected callback. The demo provided with the PUN 2 unity package doesn't get this error. However, if I do that same on a new project, neither the demo or my game can connect. Both get the clientTimeout warning.
Here's my code:
public void Connect() { Debug.Log("Connecting..."); // keep track of the will to join a room, because when we come back from the game we will get a callback that we are connected, // so we need to know what to do then isConnecting = true; // we check if we are connected or not, we join if we are , else we initiate the connection to the server. if (PhotonNetwork.IsConnected) { // #Critical we need at this point to attempt joining a Random Room. If it fails, we'll get notified in OnJoinRandomFailed() and we'll create one. PhotonNetwork.JoinRandomRoom(); } else { // #Critical, we must first and foremost connect to Photon Online Server. PhotonNetwork.GameVersion = gameVersion; PhotonNetwork.ConnectUsingSettings(); } } public override void OnConnectedToMaster() { Debug.Log("Connected to " + PhotonNetwork.CloudRegion); // we don't want to do anything if we are not attempting to join a room. // this case where isConnecting is false is typically when you lost or quit the game, when this level is loaded, OnConnectedToMaster will be called, in that case // we don't want to do anything. if (isConnecting) { // #Critical: The first we try to do is to join a potential existing room. If there is, good, else, we'll be called back with OnJoinRandomFailed() PhotonNetwork.JoinRandomRoom(); Debug.Log("Joined room " + PhotonNetwork.CurrentRoom.Name); } } public override void OnDisconnected(DisconnectCause cause) { Debug.LogWarningFormat("PUN Basics Tutorial/Launcher: OnDisconnected() was called by PUN with reason {0}", cause); }The Connect() function is called through a UI button
↧