VERY puzzling issue, NPC objects position not syncing (m_NetworkPosition 0,0,0)

Options

Hello all,

I currently have a multiplayer horror game set up where everything works except the NPC monsters positions not syncing between players. The NPC objects are created by players correctly using photon instantiate, they have photon transform views with photon views and all observed correctly, but for some reason they simply do not sync. Their movement scripts have the correct "isMine" checks to stop it interfering so I have no idea why it doesn't seem to work and I'm all out of ideas after reading the docs, tutorials and looking here.

Like I said, literally everything else works fine including players positions syncing, items syncing, literally everything except for this. The NPCs will be created and only the owner will see their position updated and the other players will see them "stuck" not moving. Even their animations work so I just cannot understand why the position isn't updating.

On debugging, it looks like the "m_NetworkPosition" in PhotonTransformView is always 0,0,0 for other players so for some reason I don't think the data is being sent, but I cannot understand why.

If anyone has any ideas on what could be behind this issue I would sincerely appreciate it! Thanks for reading and I wish you a great day!

Answers

  • Tobias
    Options

    In another thread, you pointed out you still need help on this. Let's see.

    So this is about some NPCs. Their animations sync, which means they (network-) instantiate correctly and at least some observable components are setup correctly.

    As this is not a common issue, we'll have to debug step by step. It makes sense to figure out if the PhotonTransformView is not sending data or not receiving data. It's as easy as adding Debug.Log lines to OnPhotonSerializeView(). You could simply log the value of stream.IsWriting or you could log what gets written (the position you are looking for) and what you received after m_NetworkPosition is assigned (line 124).

    If the PTV is not sending values, check why. Is the component disabled? Then it won't send anything.

    Let's see how far this gets you.