Reputation: 1
(Sending 'data' over TCP)
byte[] data = {153, 130, 0, 0 };
index = 0;
ushort nm = ExtractUshort();
public ushort ExtractUshort() {
ushort value = BitConverter.ToUInt16(data, index);
index += 2;
return value;
}
Debug.Log("nm value >" + nm);
Log output gives "nm value > 33433" in Unity.
I want to understand how this works and use it in unreal (c++ or blueprint).
Some other types:
- double value = BitConverter.ToDouble(data, index); (index += 8)
- bool value = BitConverter.ToBoolean(data, index); (index += 1)
- float value = BitConverter.ToSingle(data, index); (index += 4)
- uint value = BitConverter.ToUInt32(data, index); (index += 4)
- int value = BitConverter.ToInt32(data, index); (index += 4)
Upvotes: 0
Views: 218