unity-game-enginephoton-fusion

Fusion NetworkRigidbody blocks collisions for trigger


I want to have an interactable object with rigidbody, so I need to have networkRigidbody. But when I add this component, all collisions for trigger (child) are not getting called for client. Only host gets those calls.

Parent object

Object that contains item script

Item detecting collisions, only collides with local player:

private void OnTriggerEnter(Collider other)
{
    a.Indicator.SetActive(true);
}
private void OnTriggerExit(Collider other)
{
    a.Indicator.SetActive(false);
}

Solution

  • OnTriggerEnter / OnTriggerExit are not reliable in Fusion. This is because these are Unity methods that are called once a frame, where Fusion's resimulations on clients can cause multiple physics simulations in a single Unity frame.

    The OnTriggerStay callback does work properly however, and if you need the explicit "enter"/"exit" functions, you can use it (along with a [Networked] variable) to make your own callbacks.