0
\$\begingroup\$

I'm trying to figure out how to manually attach an XR Grab Interactable to a XR Socket Interactor but using XRBaseInteractor.selectTarget has the protected modifier.

How can you do this via C# in Unity?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

You can use the XR Interaction Manager to help with this!

Both XRSocketInteractor.StartManualInteraction(); and XRInteractionManager.ForceSelect(); are now confirmed working in the XR Interaction Toolkit 1.0.0-pre.5

Example script for testing:

using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;

public class XRSocketConnector : MonoBehaviour
{
    public XRSocketInteractor socket;
    public XRBaseInteractable interactable;
    public XRInteractionManager interactionManager;

    void Start()
    {
        // Both of these work in 1.0.0-pre.5
        socket.StartManualInteraction(interactable);
        // interactionManager.ForceSelect(socket, interactable);
    }
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .