Syncing Player Positions (Example)
Options
Comments
-
Please follow this tutorial to setup your project and prefabs.
http://doc.exitgames.com/photon-cloud/M ... 0Tutorials
Maybe you forgot to add a PhotonView to the new prefab or your scripts try to control remote players as well as local ones.
(can't check you project at the moment but those are common)0 -
Hi,
I have regone through the tutorial and done it all again. But some reason the characters arn't being synced :S. They just stay at the origin and if i add lerp to it then they just lerp between real position and origin .
Thanks.0 -
I've done abit more research and i've found that the void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {} method isn't being called at all :S. I've attached a PhotonView and told it to observe the prefab.
Any Ideas .0 -
The PhotonView observes the prefab? It should observe a script on the prefab to call that script's OnPhotonSerializeView().
Please drag & drop the script component to the PV and try again.0 -
I get what you mean as currently it doesn't know what the script is to call that method.
I've tried draging the C# script onto the observe method but it just won't work. If i drag the prefab onto observer then method won't get called. It says it has to be a transform i think.
How do i do it . I think i'm missing something easy xD.
Thanks.0 -
You need a MonoBehaviour. Add this to the GameObject where the PhotonView is. Then select the prefab and in it, select the script. Drag & drop the script component to the PhotonView.Observe field. It will accept the script if you selected is as being part of the game object.0
-
I'm confused as to what you mean. Every script in Unity already has a monobehavior?. The network player has Photon.MonoBehavior. It sounds like your saying to add it in unity not script? but you can't do that can you?.0
-
I mean: Your script has to be a part/component of the Game Object that also has the PhotonView. To "observe" said script, you have to drag&drop the script not from the project overview but from the game object's inspector.0
-
Ah i finally understand what you ment . It works great now!. Thanks so much for help.0