using Tilia.Interactions.Interactables.Interactors;
private InteractableFacade interactableFacade = GetComponentInChildren<InteractableFacade>();
//取消抓取
if (interactableFacade.IsGrabbed)
{
interactableFacade.UngrabAll();
}
//禁用抓取功能
interactableFacade.DisableGrab();
需要注意的的是,如果取消抓取后立刻销毁被抓取物体,会报错MissingReferenceException: The object of type ‘ActiveCollisionConsumer’ has been destroyed but you are still trying to access it.
需要等到下一帧再销毁被抓取物体。