Include the following details (edit as applicable):
- Issue category: Multiplayer
- Device type & OS version: Android
- Host machine & OS version: Windows
- Issue Environment :
- Xcode version:
- ARDK version: 2.5.1
- Unity version: 2021.3
Description of the issue:
private void OnDidReceiveDataFromPeer(PeerDataReceivedArgs args)
{
var data = args.CopyData();
switch ((_MessageType)args.Tag)
{
case _MessageType.BallPositionMessage:
_controller.SetBallSpeed(DeserializeFloat(data));
break;
default:
throw new ArgumentException("Received unknown tag from message");
}
}
In the code snippet above, I need to pass 2 data inside “_controller.SetBallSpeed(DeserializeFloat(data));”
meaning, the code should look something like
“_controller.SetBallSpeed(DeserializeFloat(data1),DeserializeFloat(data2));”
I am aware you need to create a new “DeserializeFloat”
private float DeserializeFloat(byte launchSpeed)
{
using (var readingStream = new MemoryStream(launchSpeed))
using (var binaryDeserializer = new BinaryDeserializer(readingStream))
return FloatSerializer.Instance.Deserialize(binaryDeserializer);
}
How can I do this in the OnDidReceiveDataFromPeer()?
Pardon me for the long code snippet.