Search code examples
unity-game-enginecommandrpcdata-transferunity-networking

How to send a photo over network with Unity?


I am trying to show the players Facebook profile picture each other when they are playing vs game. I tried to send the picture with [Command] and [ClientRpcCall] attributes but do not work. Any idea?


Solution

  • It's trivial to google an answer to this question.

    To get you started something like ...

    [RPC]
    void SendTextures(byte[] receivedByte){
     receivedTexture = null;
     receivedTexture = new Texture2D(1, 1);
     receivedTexture.LoadImage(receivedByte);
     GetComponent<Renderer>().material.mainTexture = receivedTexture;
     }
    

    Just google for 100s of full examples and discussions.

    Here's a huge discussion with many full scripts and so on

    http://forum.unity3d.com/threads/sync-texture-over-network.76538/

    Try googling,

    Unity3D send image over RPC

    Unity3D send PNG over RPC

    Unity3D texture RPC

    and so on