Search Unity

Extending the XR Interactions Toolkit (XRBaseInteractor)

Discussion in 'XR Interaction Toolkit and Input' started by roblkw, May 26, 2020.

  1. roblkw

    roblkw

    Joined:
    Oct 31, 2016
    Posts:
    2
    I'm attempting to extend the abstract class for XRBaseInteractor, using XRBaseControllerInteractor as a template and the guidance in the documentation: https://docs.unity3d.com/Packages/c...dex.html#extending-the-xr-interaction-toolkit.

    I've almost made it through, but am having trouble calling OnActivate() on an XRBaseInteractable from within my new Interactor class, since the OnActivate function is marked as internal. My understanding is that means that activating Interactables is not possible outside of the XR Interaction Toolkit assembly.

    Code (CSharp):
    1. // This code is from XRBaseControllerInteractor.cs in the ProcessInteractor() function.
    2. // Where selectTarget is an XRBaseInteractable, declared in XRBaseInteractor.cs
    3. if (selectTarget && m_Controller.activateInteractionState.activatedThisFrame)
    4.     selectTarget.OnActivate(this);
    5. if (selectTarget && m_Controller.activateInteractionState.deActivatedThisFrame)
    6.     selectTarget.OnDeactivate(this);
    The error I get is 'XRBaseInteractable.OnActivate(XRBaseInteractor)' is not accessible due to its protection level. Does that mean it's not possible to extend the Interactors such that they can call on the Interactables? I assume I'm missing/misunderstanding something.

    Thanks for any help and clarification!
     
  2. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    roblkw likes this.
  3. roblkw

    roblkw

    Joined:
    Oct 31, 2016
    Posts:
    2
    Thanks! Exactly what I was looking for.
     
  4. chichichap

    chichichap

    Joined:
    May 28, 2017
    Posts:
    15
    The site is no longer available... How do you handle internal methods you wish to use/modify?
     
  5. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Apologies: AWS is having serious problems - the server keeps going offline after 30 mins to a few hours, with no errors, and the AWS reporting tools randomly declaring "server is live" or "server is offline". I'm trying to build a fresh server to replace it, but it's taking some time to figure out what the cause of the crashes is.

    Until then: I'm rebooting it each day, and it's live for a brief time, until AWS crashes again (argh!)
     
  6. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Finally fixed, ported to a new host, site rebuilt. Theme is a bit ugly, but should be running much faster (all on AWS now).