Search code examples
c#unity-game-enginemrtk

How to change visualization profiler


I need to change my hand visualization in the middle of the game, so I would like to change the visualization profile because if I try to just remove and create a new model the old one will appear again.

I don't know how to access to profiles though code so I need some help.

I'm currently using MRTK v 2.0.0 RC1-Refresh and Unity 2019.1.0f2


Solution

  • You can access the hand tracking profile from the MRTK instance in the scene: MixedRealityHandTrackingProfile profile = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.HandTrackingProfile;

    However it is not possible to change the visualizer prefabs in the profile through code, they are readonly properties. This has several reasons:

    • Profiles properties are often just read once on start and effects will only show up after restarting
    • Default profiles are read-only anyway and not supposed to be modified

    If you want to change the hand visualization it is preferable to disable the hand visualization and then replace it by attaching your own objects to the hand joints: https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/InputSystem/HandTracking.html#joint-transform-from-hand-visualizer