Hello,
So after literally days of troubleshooting this issue, I'm giving up and want to try getting some help here.
Unfortunately, I searched this error here and didn't really get an answer for my issue.
I'll try to put as much context as I can to avoid that you miss important information to help me:
Scenes setup:
"A": Main Menu scene
"B": Lobby Scene
There is then a play scene but this doesn't matter anymore as the error only comes in the lobby scene because of the first Player models instantiation.
In Scene "A", Player 1 through the UI can create a room. there are no Photon involved here, clicking on the Create room button setup a bunch of variables and Load Scene "B"
In Scene "B", Player 1 through a lobby script, creates the Room. Then in the network manager it uses the photon Callback
In there it checks if we are Master Client, if yes we setup some room props and trigger then the instantiation of the Player Prefab using of course:
From the point in time, everything works perfectly fine
At this point, Player 2 decides to join the game. Same, Scene "A", only UI without any photon magic in this scene, it just save the room name variable and Load Scene "B" (I tried with PhotonNetwork.LoadLevel("sceneName") too)
In that scene Player 2 Join the room and that's where the disaster starts!
As soon as we join the room I get the error message. I know the error is longer that usual but I added some stuff in the Debug.Log to try to pin point what RPC was the cause from where to who etc.
As previously stated, here Player 2 through the OnJoinedRoom() Photon callback check if were are master and as it's not, it just go straight to instantiating his own Player Prefab.
The error happens before the instantiation of the Prefab. And that's where I understand why. The RPC is supposed to be received from a component that's on the Player Prefab. I didn't instantiate it yet, so it can't receive it.
The fun part of course is that this error is triggered only once and that absolutely everything is working fine after the instantiation, there are no problems at all. Everything is synced etc. So you could say "ok just ignore the error and move on" But I have OCD with those red lines. It doesn't look professional in the Player Log either and I'm not accepting errors in my project, simple as that![:) :)]()
More info:
The RPC is sent like this from another script:
The RPC is received as:
At that point I have no clue on how to troubleshoot this issue anymore. Do be fully transparent, I'm using a Unity module which lift the heavy weight on the Photon side and allow me to do most things in a visual scripting way. But I do know my way around code but that's also the reason why I'm not sharing too much details on code here, but can answer any questions of course!
In the main network manager of this module there is this:
I'm having some suspicion on the UpdatePhotonCalls() method which is:
Could that be something that onJoinRoom force RPC to be sent even though in that case the receiver isn't yet here?
I thought about instantiating my player prefab before joining the room but I though it's not possible as I'm not in a room yet I can't use PhotonInstantiate() can I?
Thank you in advance for your support, I hope my post isn't too complicated to understand
So after literally days of troubleshooting this issue, I'm giving up and want to try getting some help here.
Unfortunately, I searched this error here and didn't really get an answer for my issue.
I'll try to put as much context as I can to avoid that you miss important information to help me:
Scenes setup:
"A": Main Menu scene
"B": Lobby Scene
There is then a play scene but this doesn't matter anymore as the error only comes in the lobby scene because of the first Player models instantiation.
In Scene "A", Player 1 through the UI can create a room. there are no Photon involved here, clicking on the Create room button setup a bunch of variables and Load Scene "B"
In Scene "B", Player 1 through a lobby script, creates the Room. Then in the network manager it uses the photon Callback
public override void OnJoinedRoom()
In there it checks if we are Master Client, if yes we setup some room props and trigger then the instantiation of the Player Prefab using of course:
PhotonNetwork.Instantiate()
From the point in time, everything works perfectly fine
At this point, Player 2 decides to join the game. Same, Scene "A", only UI without any photon magic in this scene, it just save the room name variable and Load Scene "B" (I tried with PhotonNetwork.LoadLevel("sceneName") too)
In that scene Player 2 Join the room and that's where the disaster starts!
As soon as we join the room I get the error message. I know the error is longer that usual but I added some stuff in the Debug.Log to try to pin point what RPC was the cause from where to who etc.
ERROR You have missing MonoBehaviours on your gameobjects!|| And that is this RPC: UpdateCharacter|| Sender is: #01 'Necka' || Receiver might be: [1001] Photon_Player_Base_V1 - Remote [MasterClient] UnityEngine.Debug:LogError (object) Photon.Pun.PhotonNetwork:ExecuteRpc (ExitGames.Client.Photon.Hashtable,Photon.Realtime.Player) (at Assets/____Assets/__Asset Store/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:473) Photon.Pun.PhotonNetwork:OnEvent (ExitGames.Client.Photon.EventData) (at Assets/____Assets/__Asset Store/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2210) Photon.Realtime.LoadBalancingClient:OnEvent (ExitGames.Client.Photon.EventData) (at Assets/____Assets/__Asset Store/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3336) ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer) (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:891) ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:558) ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1837) Photon.Pun.PhotonHandler:Dispatch () (at Assets/____Assets/__Asset Store/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:223) Photon.Pun.PhotonHandler:FixedUpdate () (at Assets/____Assets/__Asset Store/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:149)
As previously stated, here Player 2 through the OnJoinedRoom() Photon callback check if were are master and as it's not, it just go straight to instantiating his own Player Prefab.
The error happens before the instantiation of the Prefab. And that's where I understand why. The RPC is supposed to be received from a component that's on the Player Prefab. I didn't instantiate it yet, so it can't receive it.
The fun part of course is that this error is triggered only once and that absolutely everything is working fine after the instantiation, there are no problems at all. Everything is synced etc. So you could say "ok just ignore the error and move on" But I have OCD with those red lines. It doesn't look professional in the Player Log either and I'm not accepting errors in my project, simple as that

More info:
The RPC is sent like this from another script:
public override void OnPlayerEnteredRoom(Player player) { if (photonView.IsMine && gameObject.activeSelf) { var lcm = Locomotion; photonView.RPC(RPC_CHARACTER, player, transform.position, lcm.canUseNavigationMesh, currentControls, new Vector2(Locomotion.runSpeed, currentAngularSpeed), currentGravity, currentJump, (int)lcm.faceDirection, syncAttachments ? SerializeAttachments() : emptyHashtable); } }
The RPC is received as:
[PunRPC] private void UpdateCharacter(Vector3 position, bool canUseNavigationMesh, Vector2 controls, Vector2 speed, Vector2 gravity, Vector2 jump, int faceDirection, Hashtable attachments) { Some code }
At that point I have no clue on how to troubleshoot this issue anymore. Do be fully transparent, I'm using a Unity module which lift the heavy weight on the Photon side and allow me to do most things in a visual scripting way. But I do know my way around code but that's also the reason why I'm not sharing too much details on code here, but can answer any questions of course!
In the main network manager of this module there is this:
public void OnJoinedRoom() { LastJoinedPlayer = PhotonNetwork.LocalPlayer; players = PhotonNetwork.PlayerList; clientStartTime = PhotonNetwork.Time; lastLagCheck = Time.time + DB.lagCheck * LAG_CHECK_DELAY; UpdatePhotonCalls(); }
I'm having some suspicion on the UpdatePhotonCalls() method which is:
private void UpdatePhotonCalls() { for (int i = 0, imax = PhotonCalls.Count; i < imax; i++) { PhotonCalls[i](); } }
Could that be something that onJoinRoom force RPC to be sent even though in that case the receiver isn't yet here?
I thought about instantiating my player prefab before joining the room but I though it's not possible as I'm not in a room yet I can't use PhotonInstantiate() can I?
Thank you in advance for your support, I hope my post isn't too complicated to understand