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

Adding Near Interaction to Input Field #10723

Closed cafigz closed 9 months ago

cafigz commented 2 years ago

Hi!

Is there an easy way to interact with Input Fields?

image

I've been trying to add the possibility to press on Input Field just like you would do in a Pressable Button (at the moment, I can only activate said Input Fields by using the air tap gesture).

I've tried using components like PressableButtonHololens2, Interactable, NearInteractionTouchable, but at the moment I still can't activate the TMP Input Fields by using the Press gesture.

image

MaxWang-MS commented 2 years ago

Hi @cafigz, which MRTK version are you using? I think you can try the MixedRealityKeyboardExample scene if you are using MRTK2. In MRTK 2.8.2 near interactions should be working with the input fields there.

cafigz commented 2 years ago

Hi! I have version 2.7.3, installed. I've been reluctant to upgrade, having fear it would break my project. Should I upgrade to 2.8.0?

image

I even asked in this repo if I should update from 2.0 to 3.0, and I was replied no by the devs. (https://github.com/microsoft/MixedRealityToolkit-Unity/issues/10680#issuecomment-1170386279)

MaxWang-MS commented 2 years ago

You should be able to upgrade to 2.8.2 with very few (if any) changes. Alternatively you could also check out the MixedRealityKeyboardExample scene without upgrading and see if it works for you.

cafigz commented 2 years ago

You should be able to upgrade to 2.8.2 with very few (if any) changes. Alternatively you could also check out the MixedRealityKeyboardExample scene without upgrading and see if it works for you.

Nope, with didn't work. The near interaction doesn't activate the Input Field, only the airtap does.

MaxWang-MS commented 2 years ago

I just tried the MixedRealityKeyboardExample scene shipped with MRTK 2.8.2 on HoloLens 2 and both input fields triggered the keyboard with near interaction. Note the input fields are placed somewhat far from the user in that scene so you need to walk up a bit before being able to perform a near interaction. Also, can you confirm if you were using remoting or deploying the app onto the HoloLens 2 device? The virtual keyboard does not work in remoting.

cafigz commented 2 years ago

Also, can you confirm if you were using remoting or deploying the app onto the HoloLens 2 device? The virtual keyboard does not work in remoting.

Thanks for the answer! I'm currently using the Emulator. I'll try to get this to work with the proper Hololens 2 and if I'm not abl to get it to work I'll post again, thanks again! :D

cafigz commented 2 years ago

Hi there! Before asking, just a quick thing: This link shows broken to me image

I tried MixedRealityKeyboardExample and the only one I managed to click was the non-TMP one. I wasn't able to click on the the TMP one, even with the air tap.

I got on my project and added the MRKeyboardInputField_UGUI prefab. I cannot use it with the near interaction. I even tried adding a new Simple TMP Input box, and added the 2 scripts and it still didn't work with the near interaction.

image

MaxWang-MS commented 2 years ago

Hi @cafigz, first regarding documentation: are you referring to this page? If so, the folder name is actually not designed to be a link. It's just bolded text.

Secondly, I just confirmed again that the TMP input field can be trigger by near interaction in an app deployed onto HoloLens 2. I was using a fresh Unity (2020.3.38f1) project, with the Mixed Reality OpenXR plugin 1.5, MRTK Examples 2.8.2 along with its dependencies auto-selected in the Mixed Reality Feature Tool. I simply went through the setup process with the MRTK configurator and included the MixedRealityKeyboardExample scene from the examples package in the app.

The fact that only the TMP input field in the sample scene did not work for you is confusing. Have you tried starting fresh with a new project and see what happens? Also on some versions of TMP there is a bug where the caret is not shown even after the input field is triggered. Could you make sure your HoloLens is not muted and try again to see if you can hear the sound of keyboard launch? You should be able to hear the same sound when you near press the TMP input field as the one triggered for the non-TMP input field.

If you are not using the MixedRealityKeyboardExample scene, make sure you create a world space canvas with the CanvasUtility and NearInteractionTouchableUnityUI scripts attached. Set the Events To Receive field under NearInteractionTouchableUnityUI to Pointer. Then put the MRKeyboardInputField_TMP prefab under the canvas GameObject and you should now be able to perform near interaction with the TMP input field. I have also verified this setup on device.

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 visithttps://www.mixedrealitytoolkit.org.

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