Search Unity

Feature Request protected SelectEnter & SelectExit in XRInteractionManager

Discussion in 'XR Interaction Toolkit and Input' started by sharper_immerse, Oct 14, 2020.

Thread Status:
Not open for further replies.
  1. sharper_immerse

    sharper_immerse

    Joined:
    Aug 12, 2019
    Posts:
    1
    I've been working on a project using the XRI Toolkit and am in need of more control over sockets so that I can attach objects via code. The best way I have found of doing this is by gaining access to SelectEnter and SelectExit from the XRInteractionManager class. This approach requires editing the package, which is reset when closing the project.

    It would be extremely helpful if I were able to gain access to these methods without having to alter the files in the XRI Toolkit package in any way. My suggested approach would require protected access to these two methods. I could then create my own XRInteractionManager class that inherits the original and make my project specific modifications from there.

    Code (CSharp):
    1. // Make these two methods protected in XRInteractionManager.cs
    2. protected void SelectEnter(XRBaseInteractor interactor, XRBaseInteractable interactable) { ... }
    3. protected void SelectExit(XRBaseInteractor interactor, XRBaseInteractable interactable) { ... }
    4.  
    5. /// <summary>
    6. /// Extends the XRInteractionManager to make required methods public
    7. /// </summary>
    8. public class XRInteractionManagerExtended : XRInteractionManager
    9. {
    10.     public void ForceSelect(XRBaseInteractor interactor, XRBaseInteractable interactable)
    11.     {
    12.         SelectEnter(interactor, interactable);
    13.     }
    14.  
    15.     public void ForceDeselect(XRBaseInteractor interactor, XRBaseInteractable interactable)
    16.     {
    17.         SelectExit(interactor, interactable);
    18.     }
    19. }
     
  2. Polff

    Polff

    Joined:
    May 18, 2017
    Posts:
    30
    Well, couldn't you use C# Reflection? That's how i called internal functions and forced grabbing in my VRSimulator in earlier versions.
     
  3. mfuad

    mfuad

    Unity Technologies

    Joined:
    Jun 12, 2018
    Posts:
    335
    Feel free to submit your feature request to our public roadmap and we will take it under consideration. Thanks!
     
Thread Status:
Not open for further replies.