OnPhotonSerializeView not seeing anim for remote player

Options
Hello,

I've been banging my head on this for 4 days, 10 hrs per day trying to fix this seemingly simple issue. Any help is greatly appreciated!!!!!!!!!! :?: :?:

I have looked at so many code samples and setup samples I don't think there are any left to see.

I'm using OnPhotonSerializeView trying to send an anim parameter and it's not being received by the other player. It's an int to play a flying anim if the value is 1 and to switch back to idle if set to 0.

The local player sees the change and the flying anim runs on the local end. The remote player never receives the int and the anim never plays for the remote player.

I see the parameter change in the animator window but only for the local player. The remote player's animator window never shows the change.

The other simple idle/run/jump all work ok. It's just this flying parameter simply will not work.

Any ideas what to double check to help track down the issue?

This is a code snippet. I think it is ok, yes?
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
		if(stream.isWriting) {
		
			stream.SendNext(transform.position);
			stream.SendNext(transform.rotation);
			stream.SendNext(anim.GetFloat("Speed"));
			stream.SendNext(anim.GetFloat("Direction"));
			stream.SendNext(anim.GetBool("Jump"));
			stream.SendNext(anim.GetInteger("FlyInt"));
		}
		else {
			
			realPosition = (Vector3)stream.ReceiveNext();
			realRotation = (Quaternion)stream.ReceiveNext();
			anim.SetFloat("Speed", (float)stream.ReceiveNext());
			anim.SetFloat("Direction", (float)stream.ReceiveNext());
			anim.SetBool("Jump", (bool)stream.ReceiveNext());
			anim.SetInteger("FlyInt", (int)stream.ReceiveNext());
		}
		
	}

Comments

  • FGStud
    Options
    UPDATE: I just noticed that I am getting an error on this line:

    anim.SetFloat("Speed", (float)stream.ReceiveNext());

    "NullReferenceException: Object reference not set to an instance of an object" ...
  • digitalCowboy
    Options
    Do you have a parameter called Speed of data type float in your animation controller?
  • FGStud
    Options
    Thanks for replying DigitalCowboy. It turns out I didn't have my anim update within an isMine and that caused the parameter state to be overwritten and the flying anim to not play for remote player as viewed by local player. The null error, however, is still happening and it may be a 4.6.1f2 bug. I'll update and see if it goes away. Thanks again, Tobias :)