title: How to send Texture2D over the Network in Unity?
body: <p>So, I have a game, where players, have to draw on <code>Texture2D</code> and I need to send that <code>Texture2D</code> for other players, but <code>onPhotonSerializeView</code> isn't working for that, because <code>Exception: cannot serialize(): UnityEngine.Texture2D</code>.</p>
  
  <p>I found <a href="https://forum.photonengine.com/discussion/10106/serialize-image" rel="nofollow noreferrer">this solution</a> on site, but I don't really understand it, so maybe somebody could help.</p>
  
  <p>My code:</p>
  
  <pre><code>private Texture2D DrawingSection;
  
  private void Awake()
  {
      DrawingSection = GameObject.Find("Canvas/pan_Background/pan_DrawingSection").GetComponent&lt;Texture2D&gt;();
  }
  
  private void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
  {
      if (stream.isWriting)
      {
          if (photonView.isMine)
          {
             stream.SendNext(DrawingSection);
          }
      }
      else
      {
          DrawingSection = (Texture2D)stream.ReceiveNext();
      }
  }
  </code></pre>