I was trying to work out why data was sent correctly from the server, but was being interpreted so different on the Unity client. I could easily see what bytes (in hex format) were generated by the python server(with the very useful command line debugging ability), but on Unity I needed to think for a second to determine how to display bytes nicely in a hex format for my serialized object.
The easiest way turned out to be as below.
// example byte array read from a binary stream
BinaryReader stream = new BinaryReader(buffer);
byte[] byteArray = stream.ReadBytes(3);
// import UnityEngine for Debug.Log
Debug.Log(BitConverter.ToString(byteArray));
The output looks like as follows
01-AB-CD
UnityEngine.Debug:Log(Object)
...
No comments:
Post a Comment