Hi,
How can I execute a Raise event while inside a Loop? I am sending an image in packages and it only triggers once. Many thanks in advance for the help!
EDIT: there was a tiny mistake in the code, Raise Event was working fine. Sorry for the inconveniences
↧
Raise event for sending chunks of bytes
↧
Confused about automatic switching of MasterClient and impact on Players in room
Apologies in advance, I'm sure this is covered in the documentation and other forum threads, however, I have been struggling with it for a while so decided I need to seek help! The below results suggest I am doing something wrong...
Player 1 creates and joins a room.
Player 2 joins the room.
Player 1 (Master Client) disconnects.
At this point I want (and would expect) Player 2 to take over as MasterClient and remain in the room.
However, what I am seeing is Player 2 returns to Master Server when Player 1 disconnects.
Even more confusing to me is the second scenario
Player 1 creates and joins a room.
Player 2 joins the room.
Player 2 leaves the room.
Player 1 (MasterClient) then gets kicked back to Master Server.
my RoomOptions are
var options = new RoomOptions {
MaxPlayers = 3,
EmptyRoomTtl = 5000,
PlayerTtl = 5000,
PublishUserId = true,
CleanupCacheOnLeave = true,
IsOpen = true,
IsVisible = true
};
Unity 2019.1.5
PUN 2.12
↧
↧
PUN 2: RaiseEvent causing large byte overhead in TrafficStatsOutgoing.TotalPacketBytes
Hello,
I was doing some tuning on my app, and noticed that the total number bytes sent is significantly more than the actual data. I'm using RaiseEvent, and my understanding is that it has the least overhead. It looks like packet headers should be 11 bytes.
Is there a reason why sending 217 bytes (as byte arrays) would cause a total of 900 bytes to be sent? (see image).
Let me know if I'm missing something obvious. Thanks in advance!

↧
A question about syncing seats
Hi good people of the photon community!
I am implementing a lobby inside a room with 4 seats, and I need each player that joins that room, to have information about the free seats so he can sit there..
Some points:
* Each new joined player needs to know the first free seat, instantiate there, and set it as taken..
* Each new joined player must know the location and parent of each player in the room
The main question is what will hold all the information about the 4 seats, and their availability?
Thank you !
↧
Players go through walls in build.
In the editor my character hits into the walls and Unity rigidbody does its thing. However in builds of the game the player just goes through the walls. WTF
Any idea what this is?
↧
↧
Failed to remove Gameobject
I have an item pickup script that, when hovering over on an item with your cursor at a certain distance and press F, it will delete the item and at it to the inventory. I keep getting this error when testing it with the second client that joined. I've been trying to fix it for about two hours now and I just can not find any way to fix this.
Failed to 'network-remove' GameObject. Client is neither owner nor masterClient taking over for owner who left: View (0)1 on M16 Carbine (scene)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
NetworkingPeer:RemoveInstantiatedGO(GameObject, Boolean) (at D:\Unity\Survival Inc\Assets\Photon Unity Networking\Plugins\PhotonNetwork\NetworkingPeer.cs:3463)
PhotonNetwork:Destroy(GameObject) (at D:\Unity\Survival Inc\Assets\Photon Unity Networking\Plugins\PhotonNetwork\PhotonNetwork.cs:2746)
HutongGames.PlayMaker.Actions.PhotonNetworkDestroy:doDestroy() (at D:\Unity\Survival Inc\Assets\PlayMaker PUN\Actions\PhotonNetworkDestroy.cs:37)
HutongGames.PlayMaker.Actions.PhotonNetworkDestroy:OnEnter() (at D:\Unity\Survival Inc\Assets\PlayMaker PUN\Actions\PhotonNetworkDestroy.cs:24)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:205)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:175)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2771)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2718)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2643)
HutongGames.PlayMaker.Fsm:DoTransition(FsmTransition, Boolean) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2685)
HutongGames.PlayMaker.Fsm:ProcessEvent(FsmEvent, FsmEventData) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2253)
HutongGames.PlayMaker.Fsm:SendEventToFsmOnGameObject(GameObject, String, FsmEvent) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2622)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2389)
HutongGames.PlayMaker.Actions.SendEvent:OnEnter() (at D:\Unity\Survival Inc\Assets\PlayMaker\Actions\StateMachine\SendEvent.cs:42)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:205)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:175)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2771)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2718)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2643)
HutongGames.PlayMaker.Fsm:UpdateState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2787)
HutongGames.PlayMaker.Fsm:Update() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:1995)
PlayMakerFSM:Update() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\PlayMakerFSM.cs:586)
↧
Disconnection followed by stuck reconnecting/disconnecting 'DisconnectByServerLogic'
Photon seems to be working perfectly for the most part, but we're getting these random disconnects, 'ClientTimeout', 'ServerTimeout', etc. but my game would never be able to reconnect again (which means the player cannot create/join rooms anymore) properly constantly attempting to reconnect but getting disconnected (cause 'None' and 'DisconnectByServerLogic') until an arbitrary amount of time (10-20++ minutes) pass by and it would stop disconnecting and start working again. Rebooting the game fixes the issue immediately as well. Any insight or advice would be greatly appreciated.
Internet connectivity: Wifi
Unity version 2018.2.20f1
Photon version 2.8 (was 2.5 but updating to 2.8 did not resolve the issue)
Photon analyze:
Max CCU: 5 (out of 10)
Rooms max: 3
Msgs/per room max: 44
Traffic: 54.9MB
Rejected Players: 0
↧
[UNITY PUN2] Sending network data when Time.timeScale is at zero
In my game, when the round ends, I set Unity's timeScale to 0 to freeze the background and overlay a UI. When the master client, presses continue I use PhotonNetwork.LoadLevel. However, this level change is never communicated to the other clients. I've tried using RaiseEvent to tell the clients to reset their timescale back to 1 and I've tried using RPCs. Is there any way to send network data while Time.timeScale is zero?
Thanks in advance!
↧
Time Scale = 0 cause doDispatch !
hi.
i do creating a physical game like billiard pool and for those times that other player disconnected and physics still not being idle, i need to set time scale = 0 to can pause physics. but after that if everything happen on server side like rejoining other players, it doesn't call anything like rpc or callbacks because in PhotonHandler.cs you calculate Dispatches on a fixedUpdae method! so i changed it to Update and everything working fine on timescale 0. i know this may cause some unsync issues.
someone have any suggestion or better way for fixing my problem?
ty.
↧
↧
Sending JSON
Hi all,
I need to send JSON settings file over network, is there any proper way of doing so without sending every variable by itself?
↧
Back to the basic
Hi
I'm experimenting with PUN for a multiplayer application, but i have a lot of strange behaviour, like moving the object of other and not mine also if I use IsMine, proble with instatiation that freeze the UI.
So I decided thet is time to review the basic.
First of all PUN and Realtime are the same regaring object instantiation, can I use the application ID of both without problems?
Because is not clear to me the difference between PUN and Realtime.
Sorry to bother with such stupid question, but as I said, back to the basics.
Thanks
Paolo
↧
Instantiating hitpoint debris/blood/fx with photon ?
Hi,
This is my original code to instantiate an effect wherever my raycast hits and it works, but only on my players screen as it isn't sent over the network with photon. I've looked into PhotonNetwork.Instantiate but I can't get it to work as it has to happen on the "hitpoint" in real time:
Code (CSharp):
Ray ray = new Ray(RootToShoot.transform.position, RootToShoot.transform.forward);
Transform hitTransform;
Vector3 hitPoint;
hitTransform = FindClosestHitObject(ray, out hitPoint);
if (hitTransform != null)
{
if (hitTransform.gameObject.tag == "rock")
{
GameObject impactGO = Instantiate(impactEffectrock, hitPoint, transform.rotation);
Destroy(impactGO, 1f);
}
The raycast, however, is visible over the network as I used [PunRPC] on this shooting function. I wonder how to instantiate the hitpoint effects over the network based on the code above. Can anyone help me with this? It would be very much appreciated.
↧
EMERGENCY! Publisher looking at my game RIGHT NOW and it's exhibiting the same problem!
So, I have been experiencing a point in development of two separate games that the editor just suddenly stops connecting to a build:
https://forum.photonengine.com/discussion/14181/second-game-that-photon-suddenly-stopped-connecting-in-editor-works-fine-in-builds/p1?new=1
But builds, to this point, have always connected with eachother.
Unfortunately, I was relying on that when I sent a build to a publisher Friday, who is ACTIVELY PURSUING FUNDING MY GAME.
This is a disaster. They were able to connect and see eachother's rooms on Friday, but suddenly, no changes to their devices, wifi, or behavior, they are unable to connect today. It's the same issue as in my editor: they connect to photon, search for room (they are waiting for someone to create a room before hitting join random) and it doesn't find any other rooms.
I need help ASAP - is something going wrong right now? Nothing is changed in my serversettings, region whitelist, ANYTHING! These are working builds that suddenly stop connecting!
↧
↧
when importing to unity i get a boat load of errors
Assets\Photon\PhotonUnityNetworking\UtilityScripts\Debugging\PointedAtGameObjectInfo.cs(13,19): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
Assets\Photon\PhotonUnityNetworking\UtilityScripts\Debugging\PointedAtGameObjectInfo.cs(14,19): error CS0234: The type or namespace name 'EventSystems' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
Assets\Photon\PhotonUnityNetworking\UtilityScripts\Room\CountdownTimer.cs(17,19): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
and many more, its a fresh import with no other files in a fresh 3d scene, the unity version is 2019.3.0a4
↧
PhotonView with ID 2001 has no method marked with the [PunRPC](C#) property! Args: Int32
This is the error i am getting
PhotonView with ID 2001 has no method "RPCFunction" marked with the [PunRPC](C#) or @PunRPC(JS) property! Args: Int32
and this is the Code i am Using
public void CallRPCMethod(int index)
{
GetComponent().RPC("RPCFunction", PhotonTargets.MasterClient, index);
}
[PunRPC]
public void RPCFunction(int index)
{
//int i = int.Parse(index);
foreach (GemsAndBoosterIndexing indexRefferer in FindObjectsOfType())
{
if (index == indexRefferer.index)
{
PhotonNetwork.Destroy(indexRefferer.gameObject);
break;
}
}
}
i have no idea why this is happening. Please Help
I have also checked RPC setting in Editor and "RPCFunction" is added in that list.i am using Unity 2018.2
↧
Second game that photon suddenly stopped connecting in editor (works fine in builds)
Anyone have problems with the editor suddenly (without making changes to Photon or any modules)? I changed a raycasting method in between hitting "play" and my editor suddenly doesn't see any rooms. It 'connects' and can make it's own rooms, but cannot see rooms in builds of the same version, same code. Builds can see eachother. I've tried deleting and reimporting photon, and upgrading Unity.
In fact, this happened the first time suddenly in 2019.1.4 and then again yesterday in 2019.1.5.
↧
RPC - Null Reference Exception
Hi,
I'm new to this forum so if I mess any formatting up please do say. :smile:
Anyways, currently I'm using PUN 2.0 on Unity 2018.3.0f2 and I ran into a problem with an RPC call.
The gist of what I'm trying to do is I have a plane that can bomb cars using missiles, and I need to synchronize the missiles across all clients.
The way I've chosen to do this is to have the missile be unnetworked, to save some bandwidth. Instead, I use an RPC call to instantiate a unnetworked prefab of the missile on each client with the same target, speed, etc. In order to handle collision damage, the player that gets hit by it's own local missile will take that damage.
The problem is, whenever I hit the key "e", the missile doesn't launch and instead this error code is produced in the console:
Here's the error.
NullReferenceException: Object reference not set to an instance of an object
Photon.Pun.PhotonNetwork.ExecuteRpc (ExitGames.Client.Photon.Hashtable rpcData, Photon.Realtime.Player sender) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:502)
Photon.Pun.PhotonNetwork.RPC (Photon.Pun.PhotonView view, System.String methodName, Photon.Pun.RpcTarget target, Photon.Realtime.Player player, System.Boolean encrypt, System.Object[] parameters) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1060)
Photon.Pun.PhotonNetwork.RPC (Photon.Pun.PhotonView view, System.String methodName, Photon.Pun.RpcTarget target, System.Boolean encrypt, System.Object[] parameters) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2723)
Photon.Pun.PhotonView.RPC (System.String methodName, Photon.Pun.RpcTarget target, System.Object[] parameters) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:410)
WeaponManager.Update () at Assets/Scripts/WeaponManager.cs:92
The code at WeaponManager.cs:92 is my RPC call:
photonView.RPC("LaunchMissile", RpcTarget.All);
For context, here's WeaponManager.cs:92 with surrounding code:
if (Input.GetKeyDown("e"))
{
if (FindClosestTarget(GetVisibleGameObjects()) != null)
{
Debug.Log(GetVisibleGameObjects().Count);
// Launch missile on all clients
Debug.Log(photonView);
photonView.RPC("LaunchMissile", RpcTarget.All);
AudioSource.PlayClipAtPoint(missileLaunchSound, transform.position);
}
}
And.. the RPC method (also in WeaponManager.cs) is:
[PunRPC]
void LaunchMissile(PhotonMessageInfo info)
{
Debug.Log(" LAUNCHING!");
// Create Missile
GameObject _missile = Instantiate(missile, transform.position - new Vector3(0, 4), transform.rotation);
_missile.GetComponent().SetOwner(info.photonView);
// Gather target and missile ids.
//int targetViewID = FindClosestTarget(GetVisibleGameObjects()).GetComponent().ViewID;
GameObject target = FindClosestTarget(GetVisibleGameObjects());
//int missileViewID = _missile.GetComponent().ViewID;
_missile.GetComponent().Fire(target);
}
In WeaponManager.cs, photonView is referenced in the start method:
photonView = GetComponentInParent();
I've been trying to fix this for a couple days now, so any help is greatly appreciated!
:smile:
↧
↧
Please update the links inside the PUN v1 doc
Hi,
since the introduction of the PUN V2 I often run into issues with links inside the V1 documentation pointing to outdated pages, e.g.:
https://doc-api.photonengine.com/en/pun/current/class_photon_network.html#af721675dc5cf3c5ac4d4b67339246cdf
which indeed should point to:
https://doc-api.photonengine.com/en/pun/v1/class_photon_network.html#af721675dc5cf3c5ac4d4b67339246cdf
So the only difference is the "current" vs. "v1" part. I guess you are using some CMS to maintain the doc, so it should be "not so complicated" (tm) (just avoiding the "e-word" here) to replace those outdated links.
↧
Cannot get room list inside lobby
I am now implementing the rejoin function, so before I call the ReJoinRoom function,
I need to check the last room is still existed to avoid
Operation failed: OperationResponse 226: ReturnCode: 32758 (Game does not exist )
In OnConnectedToMaster() callback, I call
PhotonNetwork.JoinLobby(new TypedLobby("GameLobby", LobbyType.SqlLobby));
to enter a named lobby and successfully get lobby information in OnJoinedLobby() callback.
In my Android device, I create a room after join lobby by
PhotonNetwork.CreateRoom(null, new RoomOptions{MaxPlayers = 2, EmptyRoomTtl = 50000, PlayerTtl = 180000, PublishUserId = true}, null);
and ensure the room is available by
PhotonNetwork.room.IsOpen = true;
PhotonNetwork.room.IsVisible = true;
in OnJoinedRoom().
Then at my Unity editor, after joining lobby, I tried to get the room list
RoomInfo[] rooms = PhotonNetwork.GetRoomList();
foreach(RoomInfo room in rooms){
Debug.Log("room : " + room.Name);
}
The room list is always empty, but I can still rejoin it by ReJoinRoom function when the room is still existed.
How to I solve it? Thank you.
↧
Back to the basic 2 - OnConnected and OnConnectedToMaster
Hi
Can someone give me some tips to fully understand the difference between the two?
I get that OnConnectedToMaster happens on the first connection to the master server, OnConnected in all the other cases?
Thanks for you help
Paolo
↧