Hi, I'm new to PUN, and decided to use V2. How can I get a list of all the active rooms that users are in?
The documentation suggests using PhotonNetwork.GetRoomList(), but this method does not exist in PUN 2. It seems to have been dropped with no replacement. ???
↧
Getting room list in PUN 2
↧
How To Invite PlayFab Friends to Play Together?
Hi everyone,
I managed to be able to get a list of friends with PlayFab. How to know whether that friend is online and able to join party of 3 to play together? Also, after the party of 3 people with friends created, since the game will be a 3v3 arena, how to create a room that will allow another 3 people to join?
Thank you for your help and support
Best Regards,
Active Dream
↧
↧
Are RPC & Raise Event guaranteed to be in order?
I know that RPC's are always guaranteed to come through in the same order. I'm not sure about RPC & RaiseEvent though.
For example if I call some RPC "Spawn Player", then I call some Raise Event "Set Player". Are they guaranteed to come through as
1. "Spawn Player" executed.
2. "Set Player" executed.
The documentation seems to be lacking on this and I would love to know.
P.S. I know that RaiseEvent has Send Reliable argument but i wasn't sure if that just effects have all events come through in the same order.
↧
OnRoomPropertiesUpdate has stale local data
Hi,
Using PUN 2 (am unsure if this was also an issue in 1.x) ...
After calling SetCustomProperties on a room a few times in a row with different values, shortly after the OnRoomPropertiesUpdate callback fires on the local client with the oldest of the values, which is obviously out of date.
For example:
Frame 1: PhotonNetwork.CurrentRoom.SetCustomProperties is called with Hashtable key = "q1" value = "Red"
Frame 2: PhotonNetwork.CurrentRoom.SetCustomProperties is called with Hashtable key = "q1" value = "Blue"
Frame 4: OnRoomPropertiesUpdate callback is received with Hashtable key = "q1" value = "Red"
Frame 5: OnRoomPropertiesUpdate callback is received with Hashtable key = "q1" value = "Blue"
To emphasise, this occurs with just a single client. On frame 4, the problem is that the value of q1 in the customProperties table is set back to Red again, even though the local client had recently set it to Blue.
On remote clients this makes sense of course, because they receive the changes in order only when they know about it (i.e. goes Red then Blue). But on the local client it's just wrong ... it goes Red,Blue,Red, Blue.
Surely if the custom properties are received only from the local client, the most recent locally set value should take precedence ?
Thanks,
Adrian
↧
Could not find RPC with index: 5
When adding a new RPC function, I've encountered errors like this. I see in Photon 2, the settings no longer shows any list of RPCs which seems to be different that the previous version. So what's the procedure for adding new RPC methods? Do I need to Clear RPCs, and then Refresh RPCs each time? I just tried Refresh RPCs and it didn't help, but it seems like this should have helped.
↧
↧
PUN Basics Tutorial Issue
Hello,
I did the pun tutorial on my own, and also used the already completed tutorial from in the unitypackage (free), and when i use the standalone and the editor to test it, 4 player prefabs are are loading in the Do not destroy on load method. Each player can move both characters. The two players with the Player UI on top are stationary and overlapping, while the two other players move around no matter from where I am controlling it.
Any assistance is appreciated, thanks.
I am using UNITY 2018
↧
Best practice for Photon Cloud connection - try all connection types?
Hi -
We have an app that connects to Photon Cloud. We've discovered that under various conditions - work networks, mobile networks, etc. - different connection types (TCP, UDP, and WebSockets) succeed and fail.
It seems like no matter whether we use ConnectUsingSettings or ConnectToMaster, we have to specify one and only one connection type. But shouldn't the client attempt to connect to Photon Cloud using each connection type in turn? That is, try UDP first, and if that fails, try TCP, and if that fails, try WebSockets?
Is there an easy (built-in) way to do this, or do we need to write a bunch of timeout callbacks ourselves?
Thanks -
Devon
↧
Is an event ReceiverGroup.All via server?
Our game has made use of RPC.AllViaServer in the past but were moving some of these RPC methods over to events. When using events how can we do something ViaServer so it's executed at the same time on all clients.
This is really important to us because a racing countdown timer.
↧
I am receiving an error when using offline mode, how to fix it?
Hi, I currently am programming a game online and I started making a singleplayer mode. For this, I am using the offline mode of Photon. But everytime I need to Instantiate something in the code PhotonNetwork.Instantiate I get an error saying "Failed to Instantiate prefab. Client should be in a room". Since I am using Offline Mode, there is no room, and it should work as a normal Instantiate. Whats wrong?
↧
↧
Player 2 OnPhotonSerializeView is updated and Player 1 is not?
I have a script that I use as a game manager which has a view owned by the scene. It holds the value for each player's character and their player ID.
I noticed that when running as first player, I am not able to see the second player's values in the inspector when player 2 updates the player 2 variables. However, player 2 gets player 1's values.
For example, when you first join the room, if you are the master client, the variable p1Username is updated. If you are not the master client, p2Username is updated.
The master client will only seen p1Username being populated. The second player will see p1Username and p2Username populated.
The same thing happens on the character select screen. When the select button is hit, player 1 can only see his own character name in the inspector but the variable for p2username is blank. However, player 2 can see both names populated in the inspector.
Am I missing something? I have the object being instantiated with PhotonNetwork.InstantiateSceneObject("MultiGameManager", transform.position, Quaternion.identity, 0, null);
It has a view object that references the script and is set to unreliable. I've also tried unreliable update and reliable.
What am I missing?
↧
RPC and packet flooding protection?
Hi!
Does Photon have protection against too many RPC commands and other packet flooding protection?
Somebody figured out how to run functions from my .NET assembly so they can send RPC's whenever they want to. Of course I can prevent this in other ways but prevention against flooding seems like a sane thing to do too.
Is there built-in support in Photon for this?
↧
NetworkCullingHandler for scene gameobjects
Hello, I think the main purpose of the CullingArea is to use NetworkCullingHandler in the player, but what about the common gameobjects with AI that runs in the master and should be sync with the rest of clients? , can we do a modification of the NetworkCullingHandler script to check if there is any player near so it will sync position,rotation,animation (through Photon Tranform and Animation Views components) and other things only when there are players around a cluster of the culling area?
Thanks!
↧
PUN 2 Problem
I have a problem here with Photon's PUN 2. Sometimes It works, but other times it doesn't. Since the last 2 weeks it isn't working that fine. Before it were better, I joined to the master, and then, to the lobby and It allowed me to list the rooms and join them without any problem. Now, I haven't changed that code that much, I only changed it after the errors started. Now, sometimes it joins a match, but another it doesn't, showing the following error:
JoinRandomRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster.
I only have 2 devices to test my online with PUN, but, even if I created a room is not working anymore, it just seems like works randomly. Here's my code if you want to check it:
void Start()
{
PhotonNetwork.ConnectUsingSettings();
}
public override void OnConnectedToMaster()
{
//This shows a popup to let know the player that is connected
//PhotonNetwork.JoinLobby();
base.OnJoinedLobby();
GameObject.Find("IWifi").SetActive(false);
print("Puga");
StatePScript.IsShow = true;
Connected = true;
GameObject.Find("IOk").GetComponent().color = Color.white;
print("IOKS Value is " + IOKS.Show);
GameObject.Find("StatusText").GetComponent().text = "Connected!";
GameObject.Find("StatusText").GetComponent().color = Color.green;
A.Play();
GameObject.Find("StatePanel").GetComponent().SetBool("Show", false);
IOKS.Show = false;
GameObject.Find("IOk").GetComponent().color = new Color(0, 0, 0, 0);
Connected = false;
StatePScript.IsShow = false;
}
I have other photon scripts like this that is the random room code:
using Photon.Pun;
public class RandomBScript : MonoBehaviourPunCallbacks
{
private Button B;
void Start ()
{
B = GetComponent
The create room code:
using Photon.Pun;
public class CreateRoomS : MonoBehaviourPunCallbacks
{
private Button B
private InputField IF;
private InputField PlayerField;
public AudioSource A;
void Start ()
{
B = GetComponent
And finally, the list rooms code:
using Photon.Pun;
using System;
public class RooManager : MonoBehaviourPunCallbacks
{
public GameObject roomPrefab;
public Sprite Four, Two, Three;
private string RoomName;
private int PlayerAmount;
private int MaxPlayers;
private Image I;
private Vector2 RoomVector;
private bool Lock = false;
public GameObject Content;
private List RoomList;
private bool IsntNull = false;
private Dictionary cachedRoomList;
private Dictionary roomListEntries;
private void Awake()
{
GameObject.Find("StatePanel").GetComponent().SetBool("Show", true);
cachedRoomList = new Dictionary();
roomListEntries = new Dictionary();
}
void Start ()
{
Content = GameObject.Find("Content").GetComponent();
RoomVector = new Vector2(370, this.transform.position.y);
}
private void ClearRoomListView()
{
foreach (GameObject entry in roomListEntries.Values)
{
Destroy(entry.gameObject);
}
roomListEntries.Clear();
}
private void UpdateRoomListView()
{
foreach (RoomInfo Item in cachedRoomList.Values)
{
RoomName = Item.Name;
PlayerAmount = Item.PlayerCount;
MaxPlayers = Item.MaxPlayers;
RoomVector.y -= 100;
GameObject RoomPrefab = Instantiate(roomPrefab, RoomVector, transform.rotation) as GameObject;
if (Item.PlayerCount == 0)
{
Destroy(RoomPrefab);
}
print(PhotonNetwork.CurrentLobby.Name);
RoomPrefab.transform.Find("RoomName").GetComponent().text = RoomName;
RoomPrefab.transform.Find("PlayerInt").GetComponent().text = PlayerAmount.ToString();
if (Item.MaxPlayers == 4)
{
GameObject.Find("IPlayerA").GetComponent().sprite = Four;
}
else if (Item.MaxPlayers == 2)
{
GameObject.Find("IPlayerA").GetComponent().sprite = Two;
}
else if (Item.MaxPlayers == 3)
{
GameObject.Find("IPlayerA").GetComponent().sprite = Three;
}
RoomPrefab.transform.SetParent(Content.transform);
}
}
public override void OnRoomListUpdate(List roomList)
{
ClearRoomListView();
UpdateCachedRoomList(roomList);
UpdateRoomListView();
print("Updated");
}
private void UpdateCachedRoomList(List roomList)
{
foreach (RoomInfo info in roomList)
{
// Remove room from cached room list if it got closed, became invisible or was marked as removed
if (!info.IsOpen || !info.IsVisible || info.RemovedFromList)
{
if (cachedRoomList.ContainsKey(info.Name))
{
cachedRoomList.Remove(info.Name);
}
continue;
}
// Update cached room info
if (cachedRoomList.ContainsKey(info.Name))
{
cachedRoomList[info.Name] = info;
}
else
{
cachedRoomList.Add(info.Name, info);
}
}
}
This script instantiates a button for every room in photon's server. If you click one button, you join that room. As I said, sometimes it work and sometimes it doesn't, sometimes it helped to comment the line PhotonNetwork.JoinLobby(), but that means that you wont see the rooms. Actually, even with or without the JoinLobby() line, it isn't working that well.
↧
↧
OnPhotonSerializeView calling conditions
Hi. I've been developing a turn based multiplayer game using PUN and I noticed something interesting about OnPhotonSerializeView method. It seems that if I'm syncing an array and I don't actually change the address of the array pointer, the OnPhotonSerializeView method isn't called.
For example: if I'm syncing "int[] arr" then doing "arr[i] = x" isn't going to call OnPhotonSerializeView.
Is this observation correct or am I missing something? Is there a documentation detailing how Photon decides when it's time to call OnPhotonSerializeView if PhotonView is set to Unreliable On Change?
↧
Question about loading additive scenes with scene objects.
Hello,
I'm loading multiple scenes additively in our large world, so that multiple scenes are open at once, this is done for optimization purposes.
One of the issues I have right now is that scene objects share Photon ID's from different scenes. It's a major pain to go through and change all of these manually as we have hundreds of objects using photon view ID's.
Is there a way to prevent the error that occurs from objects sharing the same photon ID? Can we have the master client re-assign there Photon ID's at the game start if another ID of the same type is found? Is there any easy method to do something like this?
↧
network object still remains after the owner left the room
I am not 100% sure about this. I checked if there is the owner of the drifting object in the room, but I could not find it.
Of course, this happens not very often. These objects do not disappear until the room is closed.
Does this can happen or I am doing something wrong?
I wonder if I should do check regularly if there are some independent objects in the room? Please, I need some advice.
↧
Pause serialization for specific player
Hi!
I'm sending a new scene via a custom command. But Photon doesn't seem to know about this so it sends object serializations of objects that aren't yet loaded in the lag time between sending and receiving the new scene command.
This results in a bit of warning on player connection.
What I'd basically need is to simply pause the view serialization sending for the specific player until he gets the new scene command.
Any easy way to do this?
↧
↧
photon problem to spawn all player
i have a gameobject and Script to instantiate players
void Start()
{
if (PhotonNetwork.player.GetTeam() == PunTeams.Team.blue)
{
GameObject maiPlayer = PhotonNetwork.Instantiate("Player", new Vector3(-30, 1, 0), Quaternion.identity, 0);
}
else if (PhotonNetwork.player.GetTeam() == PunTeams.Team.red)
{
GameObject maiPlayer = PhotonNetwork.Instantiate("Player", new Vector3(30, 1, 0), Quaternion.identity, 0);
}
}
this works, but the problem is that some player fails to see others. all player have photonView
the error:
Received OnSerialization for view ID 2001. We have no such PhotonView! Ignored this if you're leaving a room. State: Joined
UnityEngine.Debug:LogWarning(Object)
NetworkingPeer:OnSerializeRead(Object[], PhotonPlayer, Int32, Int16) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:4289)
NetworkingPeer:OnEvent(EventData) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2592)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)
↧
Get Player Disconnected GameObject (PhotonView)
Hi !
I use OnPhotonPlayerDisconnected(PhotonPlayer player).
I want to get the gameobject that the player instantiated before he disconnected and leave the room.
How can i do it?
Thanks.
↧
Disconnect so much , lagging sometimes animation doesn't sync ?
Hello All
i have problem but i don't know what maybe the reason could be , is it the photon problem
or my code problem
i don't know
i have a fighting game , online fighting game
i am using photon engine
i am sync ( position - animation - particles , etc ... )
problem is sometimes
Actually alot of time
i face problem that animation doesnt sync , but particles sync correctly
sometimes master / client player position is not the same
so i don't know
that is that problem in photon servers
or my code have some problems !
Any Help
Thanks
↧