Image fillAmount Photon

Options
Hello everyone. I have a picture as a health scale. I’m filling out health through the image.fillAmount. How can i do this serialization in PUN?

Comments

  • L3sc
    Options
    Hi,
    Several approach you can use here. One of these:
    
    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    	{
    		if (stream.IsWriting)
    		{
    			stream.SendNext(image.fillAmount);
    		}
    		else
    		{
    			image.fillAmount = (float)stream.ReceiveNext();
    		}
    	}
    

    Other option is send RPC when your health value changed.
  • crazy_cyxapuk
    Options
    L3sc wrote: »
    Hi,
    Several approach you can use here. One of these:
    
    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    	{
    		if (stream.IsWriting)
    		{
    			stream.SendNext(image.fillAmount);
    		}
    		else
    		{
    			image.fillAmount = (float)stream.ReceiveNext();
    		}
    	}
    

    Other option is send RPC when your health value changed.

    Thank!!! it solved my problem