The observed monobehaviour (#) of this PhotonView does not implement OnPhotonSerializeVi

Options
Hello,
I got a problem when I tried to do a simple Matchmaking but I got this Error

The observed monobehaviour (#) of this PhotonView does not implement OnPhotonSerializeView()!

and this code

void Matchmaking()
{
Debug.Log("Checking for Rooms");
if(PhotonNetwork.insideLobby)
{
var rooms = PhotonNetwork.GetRoomList();
foreach(var room in rooms)

if (room.IsOpen == true) {
string room_name = room.name;
PhotonNetwork.JoinRoom(room_name);
}


}

}

how I can fix this problem ?

Comments

  • Hi @Anteeiiku,

    if you have an object with an attached PhotonView component which is observing another component, this component (script) has to have a OnPhotonSerializeView function. So if the above shown code snippet is observed by the PhotonView component, you need to add a OnPhotonSerializeView function.

    However: as this is just about Matchmaking, you don't need PhotonViews in this state at all. You will only need them, when the client is inside a room, not in the lobby. To fix this problem, you can simply remove the PhotonView component from the object.
  • Hi @Anteeiiku,

    if you have an object with an attached PhotonView component which is observing another component, this component (script) has to have a OnPhotonSerializeView function. So if the above shown code snippet is observed by the PhotonView component, you need to add a OnPhotonSerializeView function.

    However: as this is just about Matchmaking, you don't need PhotonViews in this state at all. You will only need them, when the client is inside a room, not in the lobby. To fix this problem, you can simply remove the PhotonView component from the object.

    Thanks , problem fixed by remove PhotonView