Closed TimShaw1 closed 7 months ago
Hey, not sure what is causing this but I have a rework of the networking planned for the next update so hopefully I can get this fixed.
To add to this, the first audioclip I try to load works fine. Every subsequent audioclip I try to load throws this error.
Should be fixed in the 1.5.1 update now. Let me know if further problems appear!
Still getting this issue on 1.5.1
I am able to send my audio clips using my own custom networking class when I increase the buffer size and use ReliableFragmentedSequenced. This works over LAN but I am currently dealing with Steam saying my messages are too large.
private void SendMessage(byte[] audioClipFragment)
{
var messageContent = audioClipFragment;
//WriteToConsole("Writing message...");
// Steam has max size of 512kb (C)
var writer = new FastBufferWriter(messageContent.Length, Unity.Collections.Allocator.Temp, 512000);
//WriteToConsole("Wrote Message");
var customMessagingManager = NetworkManager.Singleton.CustomMessagingManager;
using (writer)
{
//WriteToConsole($"Writing {messageContent.Length} bytes of data...");
// Issue is here
writer.WriteValueSafe(messageContent);
//WriteToConsole("Wrote data");
if (NetworkManager.Singleton.IsServer)
{
// This is a server-only method that will broadcast the named message.
// Caution: Invoking this method on a client will throw an exception!
//WriteToConsole("Sending Message...");
customMessagingManager.SendNamedMessageToAll(MessageName, writer, NetworkDelivery.ReliableFragmentedSequenced);
//WriteToConsole("Sent Message");
}
else
{
// This is a client or server method that sends a named message to one target destination
// (client to server or server to client)
//WriteToConsole("Sending Message...");
customMessagingManager.SendNamedMessage(MessageName, NetworkManager.ServerClientId, writer, NetworkDelivery.ReliableFragmentedSequenced);
//WriteToConsole("Sent Message");
}
}
}
When sending audio clips (they are <10s in length), I get the following errors:
The clips are WAV files loaded from the disk using
UnityWebRequestMultimedia.GetAudioClip()
.