Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Unity Multiplayer [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:
    184
    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:
    184
    ah.... thanks!