Closed
Description
Describe the bug
When calling multiple RPCs in the same frame and one of them throws an exception, the RPC and all other RPCs called before it are executed over and over again.
This also happens when the RPC that throws the exception is unreliable.
To Reproduce
Steps to reproduce the behavior:
- Create a new GameObject
- Attach a NetworkObject component to it
- Attach the folowing C# script as component to it:
using System;
using System.Collections;
using System.Collections.Generic;
using MLAPI;
using MLAPI.Messaging;
using UnityEngine;
public class Bug : NetworkBehaviour
{
public override void NetworkStart()
{
StartGame();
}
private void StartGame()
{
if (IsHost)
{
Debug.Log("start");
FirstClientRpc();
SecondClientRpc();
}
}
[ClientRpc]
private void FirstClientRpc()
{
Debug.Log("first");
}
[ClientRpc] // [ClientRpc(Delivery = RpcDelivery.Unreliable)] also causes the same error
private void SecondClientRpc()
{
Debug.Log("second");
throw new NotImplementedException(); // or any other exception
}
}
- Run game in editor
- Start host on network manager
- See error (the RPCs are called multiple times like in the screenshot)
Expected behavior
All RPCs are only called once and then either unreliable or all RPCs that throw an exception are dropped.
Environment:
- OS: Windows 10
- Unity Version: 2020.3.2f1
- MLAPI Version: v0.1.0
- MLAPI Commit: 3e3aef6