XRGrabInteractable colliders do not update dynamically

I am working in a VR app that build an asset.

Parent object have an XRGrabInteractable and when inserting a child object in the parent during the game I want to add its colliders to the already existing XRGrabInteractable component .
I can add them by the following script and colliders components are effectively added to the parent XRGrabInteractable component but when trying to interact with them in VR no Grab happens.

XRGrabInteractable grabInteractableParent = parentModule.GetComponent<XRGrabInteractable>();
foreach (BoxCollider collider in boxColliders)
{
    // Add the new collider to the colliders array
    grabInteractableParent.colliders.Add(collider);
}

Is it any present any sort of method like grabInteractableRefAssembly.RebuildColliders() which allow to reevaluate which are the colliders of the component? I am bypassing the problem by destroying the old XRGrabInteractable component and create a new one to include all of the child colliders.
This solution works but if the player is holding the object while the component substitution happens, of course grab functionality will be deactivate for the small moment in which substitution is happening and it is pretty annoying to have the object falling.

Does someone knows how to update the XRGrabInteractable component efficiently?
Thanks

This is an interesting question, I’m looking into this also. It is important for example if you have a weapon with attachments, and you snap an attachment to the weapon (at least, which changes the shape of the weapon, say attaching a bayonet to a rifle). If I test it and get it working I will post a reply here.

1 Like

You can use the XRInteractionManager.RegisterInteractable() or XRInteractionManager.UnregisterInteractable() to register changes made to the collider list stored in your interactable.
It’s worth looking at the code to see but the important comment for removing colliders is that it assumes all colliders in interactable’s list has been there since the object’s registration. So, you would need to unregister first, remove the collider, then reregister the object.
It might end up still canceling your interaction with the object when you unregister, but this would be a start.
I referenced this forum posting for finding the solution.