Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

[SOLVED]Receiving Error SendByChannel with sending Lists

Discussion in 'Multiplayer' started by rob_vld, Jun 30, 2015.

  1. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    I am probably overlooking something, but are you able to send over Lists with SendByChannel?

    Code (CSharp):
    1. public class MsgEntityPositionUpdate : MessageBase
    2.     {
    3.     public List<Guid>       guid;
    4.     public List<Vector3>    position;
    5.     public List<float>      angleTorso;
    6.     }
    7.  
    ServerSide:
    Code (CSharp):
    1.             var msgEntityPositionUpdate         = new MsgEntityPositionUpdate( );
    2.             msgEntityPositionUpdate.guid        = new List<Guid>( );
    3.             msgEntityPositionUpdate.position    = new List<Vector3>( );
    4.             msgEntityPositionUpdate.angleTorso  = new List<float>( );
    5.  
    6.             msgEntityPositionUpdate.guid.Add( user.Key );
    7.             user.Value.networkConnection.SendByChannel( MsgTypeCustom.EntityPositionUpdate, msgEntityPositionUpdate, ChannelReliableSequenced );
    8.  
    ClientSide:
    Code (CSharp):
    1.     private void OnEntityPositionUpdate_C( NetworkMessage networkMessage )
    2.         {
    3.         var msgEntityPositionUpdate = networkMessage.ReadMessage<MsgEntityPositionUpdate>( );
    4.         Debug.Log( msgEntityPositionUpdate.guid[ 0 ] );
    5.         }
    6.  
    ClientErrorMessage:
     
  2. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    you cannot send generic List<>s, although you can send arrays.
     
  3. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    ah.... thanks!