Search Unity

Question Cannot Access TriggerContactMonitor

Discussion in 'XR Interaction Toolkit and Input' started by FernwehSmith, Aug 31, 2022.

  1. FernwehSmith

    FernwehSmith

    Joined:
    Jan 31, 2022
    Posts:
    36
    Hello all,
    I'm trying to make a custom socket interactor and I want to make use of the TriggerContactMonitor (as all the other Interactors do). However, anytime I try to access it in any way, even instantiating a new object, I get an error that states "'TriggerContactMonitor' is inaccessible due to its protection level". I'm confused because the other interactor classes have no problem using it. I've made sure to include all necessary name spaces, made sure my class is public, and put the class under the Interaction Toolkit name space. I've even go so far as to copy the entirety of the socket interactor class code into my own file and just changing the class name. Still no luck though. am I missing something super obvious?

    Update: Its not just the TriggerContactMonitor. A whole bunch of toolkit classes have this issue.
     
    Last edited: Aug 31, 2022
  2. VRDave_Unity

    VRDave_Unity

    Unity Technologies

    Joined:
    Nov 19, 2021
    Posts:
    277
    Hey @FernwehSmith,
    Making some of the XRI Toolkit classes internal was by-design. We do this when we feel there may be additional changes or churn to the code that we may not want developers depending on. TriggerContactMonitor is in a state where we can likely make it public or protected so that others can use it. We'll create a task in our backlog to do this in an upcoming release.

    In the meantime, you have 2 options available to you. You can just straight-up copy the file and contents into a new file with a slightly different class name so that you can build something around it. The other option is to copy the entire XRI package folder to another local folder you can modify it from and edit the file to make it public. The 2nd approach makes it harder to upgrade version-to-version for the package, but would allow your code to depend on the actual class name for when we do make that class public.