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
Documentation

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.

Read More on
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.

OnPhotonSerializeView() not getting called.

TapOnFire
2013-01-25 04:36:03

I'm following the Monster tutorial, trying to apply it to my own code, but OnPhotonSerializeView() is not getting called.

I have a "Scripts" GameObject that has a RandomMatchmaker.cs component that instantiates a prefab:

[code2=csharp]public class RandomMatchmaker : Photon.MonoBehaviour {

}[/code2]

That prefab has a PhotonCharacter component:

[code2=csharp]public class PhotonCharacter : Photon.MonoBehaviour {

}[/code2]

When I build and run, and have the editor version going, I can move the character in one app and see it move it the other, and vice versa, so that is all working, but I'm trying to smooth out the movement as suggested in the tutorial.

How can I ensure that OnPhotonSerializeView() gets called?

Comments

Tobias
2013-01-25 10:09:36

Select the prefab in the inspector and drag and drop the script onto the PhotonView's "Observe" item. This sets the PhotonView up to call OnPhotonSerializeView on this script.

The alternatives would be to just sync the transform or nothing at all.

TapOnFire
2013-01-25 20:17:09

Thanks, OnPhotonSerializeView() gets called now. This wasn't clear to me in the tutorial.

dreamora
2013-01-26 08:00:45

@TapOnFire wrote:

Thanks, OnPhotonSerializeView() gets called now. This wasn't clear to me in the tutorial.

This behavior is the same as it is for Unity networking actually :)

TapOnFire
2013-01-26 11:20:01

@dreamora wrote:

This behavior is the same as it is for Unity networking actually :)

Ah... that explains it. I've never used Unity networking, I went straight to Photon. I guess I'll read up on Unity networking too.

3ncrypt0
2013-01-26 16:02:11

Hey guys,

can anybody tell me, why my object that have the OnPhotonSerializeView() attached, starts at position 0,0,0? [EDIT: Double post from here: viewtopic.php?f=17&t=2374&p=11163#p11136]

Tobias
2013-01-28 13:19:27

Please no double posting. You can't expect a faster answer due to many posts. The same few helpful people will try to read and answer, no matter how often you post.

Back to top