Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Serialize Image

$
0
0
I want to spawn a RawImage over the network.
I´ve added this script to a prefab to be spawned:

[RequireComponent(typeof(PhotonView))]
public class exchange_frame : MonoBehaviour {

[SerializeField]
public RawImage rawImage;

void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting)
{
stream.SendNext(rawImage);
}
else
{
rawImage = (RawImage)stream.ReceiveNext();
}
}
}

But I received the following: Exception: cannot serialize(): UnityEngine.UI.RawImage
Should I convert to byte[] ? Or what else?

Viewing all articles
Browse latest Browse all 8947


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>