Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left-click doesn't act as 'tap' in Unity Editor. #1537

Closed
larsonmattr opened this issue Dec 17, 2017 · 11 comments
Closed

Left-click doesn't act as 'tap' in Unity Editor. #1537

larsonmattr opened this issue Dec 17, 2017 · 11 comments

Comments

@larsonmattr
Copy link

Overview

The mixed reality toolkit isn't recognizing the left-click (Shift and left mouse button) as an air tap when running a Mixed reality toolkit scene 'TapToPlace'.

Expected Behavior

The editor should also work with clicks -> airtap input for all scenes/scripts. This is required to test scenes in the editor before spending time to upload to the device.

Actual Behavior

Right mouse works to rotate screen, but "Shift + left-click" isn't creating input events for air taps. TapToPlace class implements IInputClickHandler, so it seems that the IInputClickHandler is generally broken in the editor with the current mixed reality toolkit unity branch.

Steps to reproduce

  • Clone MixedRealityToolkit-Unity a75c059... commit as latest, (December 14th, latest).
  • Use any Unity Editor from 2017.1 on.

Unity Editor Version

  • I am using Unity Editor 2017.3.0f2, but I have tried on several versions of Unity Editor from 2017.1, 2017.2, upwards and all have broken response to IInputClickHandler in the editor.

Mixed Reality Toolkit Release Version

Latest master branch as of 2017 December 14th (a7c059cac50204c.. commit).

@larsonmattr
Copy link
Author

I just tried this with the MixedRealityToolkit-Unity release for 2017.2.1f1 and Unity 2017.2.1f1. When I open the scene for example "TapToPlace", and run it in the editor I am unable to select a box and move it with "Control left-click". Previously, this worked with the older HoloToolkit, and I am unable to find how to trigger the IInputClickHandler events with the recent MixedRealityToolkit-Unity when running a scene in the editor.

@GKersten
Copy link

I'm experiencing same issues when trying to run my app in Editor. I am not sure how it is supposed to work at the moment. But I figured out things seem to work as the used to in the Editor, when:

First, Turn off Virtual Reality Support in Player Settings.

Next, Edit the script for CustomInputSelector:
#if UNITY_2017_2_OR_NEWER
spawnControllers = !XRDevice.isPresent && XRSettings.enabled && simulateHandsInEditor;
#else
spawnControllers = simulateHandsInEditor;
#endif

to just
spawnControllers = simulateHandsInEditor;

I discovered that the problem is that I had Mixed Reality portal installed, but did not want to use it and just test in the Unity Editor. However XRDevice.isPresent returns true when the portal is installed, even when no device is connected or running.

So next thing I did: I uninstalled the Mixed Reality Portal (where this turned to a crash of Unity in previous versions this seems to be fixed now), and I toggled the Virtual Reality support back on and reverted the changes I made in CustomInputSelector. The result now is that things work correctly again in the Editor, because XRDevice.isPresent = false, so spawnControllers will be true.

I think the ultimate fix would be an adjustment to CustomInputSelector where we can tell if we want to use the Editor or Mixed Reality Portal since XRDevice.isPresent is not reliable for that purpose.

Maybe @StephenHodgson can shine some light on this.

@StephenHodgson
Copy link
Contributor

I'll be taking a look at this today.

@StephenHodgson
Copy link
Contributor

StephenHodgson commented Dec 19, 2017

I found a more elegant solution that still takes editor into account:

spawnControllers = Application.isEditor && simulateHandsInEditor;

@larsonmattr
Copy link
Author

I tried patching my local toolkit with #1550's changes. Works great! I am excited to be able to move to the latest MRTK.

@keveleigh
Copy link
Contributor

keveleigh commented Dec 28, 2017

However XRDevice.isPresent returns true when the portal is installed, even when no device is connected or running.

@GKersten, which version of Unity are you using? I'm unable to repro that with 2017.2.1f1 with the Mixed Reality Portal installed but no headset attached:
image

The portal launches itself when I hit play in Unity, but tells me to connect a headset and focus stays in Unity.

EDIT: I'm also unable to repro with 2017.3.0f3, and the portal doesn't launch anymore with this version.

@keveleigh
Copy link
Contributor

keveleigh commented Dec 28, 2017

I'm also unable to repro the originally reported issue with Unity 2017.2.1f1. I'll install 2017.3 now.

unityhands

EDIT: I'm also unable to repro with 2017.3.0f3.

@brean
Copy link

brean commented Jan 3, 2018

I'm also not having the problem in 2017.3.0f3.
But I noticed that if you set the compile target to "PC Standalone" instead of UWP the hands are not shown and it does not work (you can look around using the right-click but the hands are not shown and the air-tap [shift+click] does not work).

I don't know if there are people out there who like to compile their App as Standalone but I think we can ignore that...
[EDIT] I just saw #1520 , so there are people who like to compile as Standalone and seem to have this issue

@larsonmattr
Copy link
Author

StephenHodgson had submitted a PR, but this never got included.

I found looking at his changes that if:

@larsonmattr
Copy link
Author

No controllers in editor when:
bool spawnControllers = !XRDevice.isPresent && XRSettings.enabled && simulateHandsInEditor;

Controllers in editor when only:
bool spawnControllers = !XRDevice.isPresent && simulateHandsInEditor;

@StephenHodgson
Copy link
Contributor

Pretty sure this was fixed.I was also unable to repro this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants