OnPhotonSerializeView on a non-active gameObject

Options
I wrote an OnPhotonSerializeView function to sync my information of a gameObject and ONLY the MasterClient was able to write to others

So this is the process of my code:
1) The gameObject was setActive to false locally by all the players, the gameObject syncs and log nothing
2) MasterClient gameObject SetActive to true, it starts to spam the Debug.Log("Sending") to my console
3) Other Player's gameObject sync and activate their gameObject (*!*)
4) After a few interaction, the MasterClient gameObject is SetActive to false again
5) But since the MasterClient has disable the gameObject, OnPhotonSerializeView is not spamming Debug.Log("Sending")
6) Other Player's gameObject are not SetActive to false

My Question is : How does the inactive gameObject on other player's able to sync the active state of the masterClient gameObject ? ( Which is Part 3 in the process )

Anyone have similar issues ? I like to understand why, tried to narrow down the issue but still lack of understanding the mechanism
	
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
	{
		if( stream.isWriting && PhotonNetwork.isMasterClient )
		{
			stream.SendNext( gameObject.activeSelf );
			stream.SendNext( status.text );
			foreach( GameObject item in items )
			{
				stream.SendNext(item.activeSelf);
			}
			Debug.Log("Sending");
		}
		else
		{
			Debug.Log("Receiving");
			gameObject.SetActive((bool)stream.ReceiveNext());
			status.text = (string) stream.ReceiveNext();
			foreach( GameObject item in items )
			{
				item.SetActive( (bool)stream.ReceiveNext());;
			}
		}
	}

Comments

  • Tobias
    Options
    Inactive components don't send updates by design.

    It's likely that you can find and modify the piece of code in PUN to change that but at the moment, I can't find you this code (due to summer holidays, we don't have as much time to help as usual).