Hi,
I don’t have too much experience with networking, but I’ve managed to implement a working solution using the Unity Transport guides found here: Workflow: Creating a minimal client and server | Unity Transport | 0.3.1-preview.4
However, I’m getting a weird issue, where on some devices only a System.InvalidOperationException is thrown with the message: EndSend without matching BegindSend, as soon as a device joins the game. The error is coming from Unity.Networking.Transport.NetworkDriver.EndSend.
My code causing the error is here:
while (_clientInputs.Count > 0)
{
byte[] inputBytes = _clientInputs.Dequeue().PackToBytes();
NativeArray<byte> bytes = new NativeArray<byte>(inputBytes, Allocator.Temp);
m_Driver.BeginSend(m_Connection, out DataStreamWriter writer);
writer.WriteBytes(bytes);
m_Driver.EndSend(writer);
}
This code is from the Update loop. Is the issue that I’m using a while loop here? (not sure if I’m not allowed to send more than once per Update). Or am I using the NativeArray wrong? Or is it something else entirely?
An example of this error occurring is when I host on my PC and try to join with my Android device, then the Android gets this error. If I host on my Android and join with my PC there is no issue. I’ve also gotten the error with iOS devices trying to join each other, but most devices seem to have no problem.
I’ll be happy to provide more information.