- Home /
XR Interaction Toolkit OnSelectExit is never called
Hi all,
I'm having some problems with the selection: while SelectEnter is correctly called by the InteractionManager, SelectExit is never called.
I'm using the laser to select objects ("hover to select" field of XRRayInteractor set to true), the problem is: once an object is selected, I'm not able to select another object by interacting with it through the laser because the previous one keeps being in the selected state although it is no more hit by the laser.
Debugging the application I've discovered that the SelectExit is never called by the InteractionManager, because the if statement of the following code is never passed, because interactor.selectTarget is set to null, for reasons I ignore, because interactor.selectTarget is correctly set in the selection phase.
void ClearInteractorSelection(XRBaseInteractor interactor)
{
// TODO: Make sure SelectExit is called if the selectTarget of the interactor is destroyed (and write a test around this).
if (interactor.selectTarget &&
(!interactor.isSelectActive || !interactor.CanSelect(interactor.selectTarget) || !interactor.selectTarget.IsSelectableBy(interactor)))
SelectExit(interactor, interactor.selectTarget);
}
I'm quite sure I'm using the scripts the wrong way, so which is the correct way of enabling selection through the laser?
Thanks in advance
Answer by ddsim · Oct 30, 2020 at 09:20 AM
@BentelAnnR Did you find a solution to this? I'm experiencing the same issue.