RPC and String Problem

I hoping someone can help me. I am sending a texture over RPC using the following code (assume tex is a Texture2D object)…

System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
String str = enc.GetString(tex.EncodeToPNG());
Debug.Log(str.Length);
networkView.RPC ("receiveTexture", RPCMode.All, str);
[RPC]
void receiveTexture(String str) {
  Debug.Log(str.Length);
  tex.LoadImage(enc.GetBytes(str)); // Update the pixel on our texture
  tex.Apply( true );
}

The length of the string sent is approx 150 bytes, but the receiveTexture only ever receives a string of length 8 bytes.

I cant seem to spot what I’m doing wrong.

Cheers
Rooch

It turns out you can send byte [ ] over RPC, so the conversion isn’t necessary.

Problem solved!

Yep, actually strings are limited to 4096 length when send over RPC, where byte[ ] is unlimited. So byte[ ] is the better option.