The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Manually Instantiated Network Object Not Syncing Position Correctly

2022-04-23 23:58:01

I've followed the documentation regarding this and I've placed a PhotonRigidbodyView (and also tested with a PhotonTransformView) on the game object that has been created. I've obviously also synced the ViewID across clients but the position doesn't appear to sync most of the time (but not all the time, it does sometimes work but I can't see why).

What I have noticed is that if I use RPCs to manually send over the position and rotation it works flawlessly so I'm certain the networking is fine, so its something to do with how the PhotonRigidbodyView of PhotonTransformView works... I'd prefer to use these than my own implementation if possible.

One additional interesting thing I've noticed is that the distance check (m_TeleportIfDistanceGreaterThan) kicks in when the gameobject is far enough away, which is more proof that the client is aware of its position, but the position itself just doesn't seem to sync. I thought at first maybe its something like isKinematic but that's not it either.

I have also tried running FindObservables(true) on all clients once the components have been added, but that was a total guess and obviously didn't help.

Is there anything in particular I need to do in order for the PhotonRigidbodyView and PhotonTransform view to work consistently when manually creating the networked object?



2022-04-27 13:30:57

When you manually instantiate networked objects, make sure their PhotonView has some scripts in the observed list on each client. It's also not synced. RPCs are not recommended to sync positions / movement.

If your feeling tells you that the scripts are setup and react to teleporting, you might want to debug what the PhotonRigidbodyView and PhotonTransformView are sending and receiving. In doubt, just Debug.Log() what's sent / arriving.

2022-04-29 20:58:06

Can I double check what you mean by "its also not synced"? I have checked that there are observables in the observed list. I made sure to run pv.FindObservables(true) each time I create the gameobject.

Back to top