microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

Can't enable/disable Teleportation System in scripting #7100

Closed rajandeepavontus closed 9 months ago

rajandeepavontus commented 4 years ago

Describe the bug

I have been trying to disable the teleportation system on a button press: CoreServices.TeleportSystem.Disable(); but for some reason, the system stays enabled.

To reproduce

  1. Create a scene with teleportation enabled
  2. Add "CoreServices.TeleportSystem.Disable();"in the start() function of a new script that is present in the scene.
  3. Play the scene and you'll notice that the Teleportation system is still enabled.

Expected behavior

The teleportation system should have been disabled.

Your setup (please complete the following information)

Target platform

keveleigh commented 4 years ago

Related to https://github.com/microsoft/MixedRealityToolkit-Unity/issues/5901, in at least the context that systems should internally respect their enabled / disabled state.

The other side of this is whether MRTK methods like Enable and Disable should be manually called vs only called by the service manager.

rajandeepavontus commented 4 years ago

@keveleigh Is their a workaround for this issue?

keveleigh commented 4 years ago

Is their a workaround for this issue?

Not just yet, thought you could edit the your local code to add a bool that you set in Enable and Disable. I've also added this to the 2.4 milestone and will work to get a fix in for that release. Due to the relationship between the teleport pointer and the teleport system, it's a bit less straight forward than I would have liked, but I have some ideas.

Troy-Ferrell commented 4 years ago

@keveleigh FYI for #7145

Can you use this workitem to track the E2E of teleport system? I added code so that teleport system won't respond to teleportation events if disabled...but there is the matter of the teleport pointer as you pointed out. Can you tackle that here?

keveleigh commented 4 years ago

@Troy-Ferrell Sounds good!

rajandeepavontus commented 4 years ago

I did a quick fix for the teleportation pointer in my local repo. Thanks for looking into this!

stale[bot] commented 4 years ago

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

rajandeepsingh13 commented 4 years ago

This issue still exists.

DevSelchow commented 3 years ago

Still exist in v2.5. Any Updates On this? I am unsure how to implement the workaround that was mentioned. Can you someone Explain if further?

torynfarr commented 3 years ago

I'm experiencing this issue as well using MRTK v2.6.1 and Unity 2019.4.25f1.

torynfarr commented 3 years ago

Here's a suggested workaround:

When you need to disable the teleportation system, have a script change the layer of all the teleportation hot-spots / surfaces in your environment to a layer other than the one you've defined as valid for teleportation.

This won't prevent the teleportation arc / beam from being displayed when the user makes the hand gesture... but it will prevent them from teleporting.

nomi27951 commented 3 years ago

Any update on this issue? Thanks

kapitanmliko commented 3 years ago

This issue is still valid in v2.7.2 What I've tried:

`
var teleportServiceName = "Mixed Reality Teleport System"; var teleportService = mrtk.GetService(teleportServiceName);

        CoreServices.TeleportSystem.Disable();
        // also
        teleportService.Disable();

        // destroy and dispose do not work either.
        teleportService.Destroy();
        teleportService.Dispose();

        // and this
        mrtk.UnregisterService(teleportService);
        mrtk.UnregisterService<IMixedRealityTeleportSystem>(teleportServiceName);
        mrtk.DisableAllServicesByTypeAndName(typeof(IMixedRealityTeleportSystem), teleportServiceName);`

no success... my current workaround is to load different MixedRealityToolkitConfigurationProfile at runtime.

nomi27951 commented 3 years ago

@kapitanmliko The solution we found was to get "FindObjectsOfType" of "TeleportPointer" and then disable it.

ClaudiaST commented 2 years ago

The temporary solution I found was to disable all colliders in "SceneContent" children (Empty GameObject that contains all the assets that make up the scene).

foreach (var all in SceneContent.GetComponentsInChildren<Collider>()) { all.enabled = false; }

Doesn't disable the teleport system entirely, but prevents the player from teleporting. It was really simple to implement so I hope it can be of help!

IssueSyncBot commented 9 months ago

We appreciate your feedback and thank you for reporting this issue.

Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.

Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.

Please note that MRTK3 was released in August 2023. It features an all-new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visit https://www.mixedrealitytoolkit.org.

Thank you for your continued support of the Mixed Reality Toolkit!