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 Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Unity Multiplayer POCO parameter crashes host

Discussion in 'Multiplayer' started by michaelgburton, Jun 27, 2015.

  1. michaelgburton

    michaelgburton

    Joined:
    Sep 19, 2014
    Posts:
    4
    I have this POCO definition in my code:

    Code (CSharp):
    1. [System.Serializable]
    2.     public class Description {
    3.         public Description() {
    4.             Role = Roles.OneOnOne;
    5.             Commitment = Commitments.Balanced;
    6.             Speed = 20;
    7.         }
    8.         public Description (Roles role, Commitments commitment, float speed) {
    9.             Role = role;
    10.             Commitment = commitment;
    11.             Speed = speed;
    12.         }
    13.         public Roles Role;
    14.         public Commitments Commitment;
    15.         public float Speed;
    16.     }
    And I have this Command definition:

    Code (CSharp):
    1. [Command]public void CmdSpawnContender (Contender.Description description) {
    2.         SpawnContender(description);
    3.     }
    When I call the command from a client, however, my host crashes silently, not even a bug reporter window. Anyone have any idea why this would happen?
     
  2. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    you cant use a class like that in a command. you can use basic types, structs, and most unity types.

    if it just crashes though, that would be a bug.
     
    michaelgburton likes this.
  3. michaelgburton

    michaelgburton

    Joined:
    Sep 19, 2014
    Posts:
    4
    Struct fixed it, thanks.