Author Topic: Transmitting Custom Types  (Read 1887 times)

Manmax75

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 32
    • View Profile
Transmitting Custom Types
« on: July 03, 2013, 07:36:14 AM »
Hey, I'm wondering if it's possible to use the tno.Send command to send custom types.
I currently have this:

  1. using UnityEngine;
  2.  
  3. // Data buffer struct for client and server.
  4. public class State : System.Object
  5. {
  6.         public float timestamp {get; set;}
  7.         public Vector3 pos {get; set;}
  8.         public Vector3 rot {get; set;}
  9.         public Vector3 velocity {get; set;}
  10.         public Vector3 angularVelocity {get; set;}
  11. }
  12.  

Now, initially I got an error in the TNUnityTools.cs, and it was here that I found the list of types. I added my case in the ReadObject function and WriteObject function.
This seemed to resolve all issues there, but now I'm getting this exception from TNObject.cs:

  1. Exception has been thrown by the target of an invocation.
  2. RigidbodyHandler.HandleSync (State)
  3. UnityEngine.Debug:LogError(Object)
  4.  

« Last Edit: July 03, 2013, 08:43:48 AM by Manmax75 »

Manmax75

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 32
    • View Profile
Re: Transmitting Custom Types
« Reply #1 on: July 03, 2013, 08:44:46 AM »
Nevermind, I found it easier to simply deconstruct and reconstruct the custom type before and after I send.