Instantiate causes OnSerialization 'no such PhotonView' err

I'm using PhotonNetwork.Instantiate and PhotonNetwork.InstantiateSceneObject to respawn player objects during a match. Maybe 1 out of 20 times a client will say "Received OnSerialization for view ID ###. We have no such PhotonView!'

It appears that it's sending a serialization message to the client before the game object and photon view are configured on the client.

I don't think it's causing any problems, but I'd definitely like to know if there's anything I'm doing wrong or if there is a way to avoid this situation. Thanks!

Comments

  • I don't think it's your fault.
    It might be we are sending an update in the frame when you created a GameObject. On the receiving end, we get the instantiate still before the update but (here's the issue) the PhotonView on the new GameObject registers itself within Awake, which is maybe called after dispatching incoming messages finished.

    I will have a look but can't promise a quick fix.

    Maybe you could try to figure out if the OnSerialization comes for a new GameObject or if it targets a GameObject you destroyed?
  • Ah, that makes sense.

    It's definitely coming from new GameObjects - I'm calling PhotonNetwork.Instantiate and in the next line of code I send an RPC to that photon view (to configure associated player attributes), and I can tell that the view ID within the OnSerialize 'no such Photon view' error message matches the photon view that (successfully) receives the RPC.

    It's actually interesting that the RPC works, I suppose on the client side it instantiates the object, receives a serialization message (triggering the warning), awakens and attaches the photon view, and then processes RPCs.
  • Thanks for taking another look at this!
    I think the situation is relatively clear then. Most likely PUN will log this case but also handle it successfully. It seems I should remove the log entry (which was very likely just a note for myself).

    Sorry for the confusion this caused.
  • This started to occur today on player instantiation. We never had this and we didn't change anything related to the player instantiation. I started to test the zips I made frequently during the last months and it occurs with every old project I open. I'm really confused about that, any thoughts?

    Edit: The log actually does not freak me out that much, but the problem is, that all players get kicked from the server frequently for no apparent reason.
  • Stardust:
    There is no known issue that should trigger a disconnect randomly. In most cases, it's a question of "how much do I send, compared to how much my client can cope with".
    Please check if you can find some hint for your case on this page:
    http://doc.exitgames.com/en/realtime/cu ... isconnects

    If not, let us know more exactly what you do and where you fail.
    In best case, open your own, descriptive thread.
    Thanks!
Sign In or Register to comment.