question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Input Manager & BaseEventData uses parameter that hides inherited property

See original GitHub issue

the tag property when initializing event data hides inherited UnityEngine property tag.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
StephenHodgsoncommented, Sep 27, 2017

@mrbobbybobberson, thanks for the details!

That being said, I hear recent Unity betas may have started routing 6DoF controller buttons (and maybe even airtap and clicker?) through its Unity axes as well, which would make my distinction of the UnityInputSource and the InteractionSourceInputSource break down, since I wouldn’t be able to tell which Unity axis inputs were from an Xbox gamepad versus a 6DoF controller.

Yeah I actually just pushed an update that handles exactly that. Building a list of recognized controllers and handling them appropriately. Check out GamePadInputSource.cs on the master branch. I still need to work on how this will be compatible with the motion controllers though in the dev branch.

Although, I’m really interested to see how the new Unity Input System is supposed to handle controllers in the future.

1reaction
mrbobbybobbersoncommented, Sep 27, 2017

Hey @StephenHodgson, I used tag on a project a few months ago where we had to support 6DoF controllers, Xbox gamepads, and airtap. I created an enum called AppCommand with different high-level, app-specific commands (Teleport, QueryData, PlaceSensor, etc). In my Unity project’s input settings, I defined Unity axes and mapped Xbox gamepad buttons to them. I made a UnityInputSource class that inherited from BaseInputSource that processed the Unity axes and mapped them to the correct AppCommand. I augmented InteractionSourceInputSource to assign the correct AppCommand for 6DoF controller and airtap input. Then, in all of my input handlers, I just asked which AppCommand to decide how to interpret the input.

That being said, I hear recent Unity betas may have started routing 6DoF controller buttons (and maybe even airtap and clicker?) through its Unity axes as well, which would make my distinction of the UnityInputSource and the InteractionSourceInputSource break down, since I wouldn’t be able to tell which Unity axis inputs were from an Xbox gamepad versus a 6DoF controller. I’m not sure how I would have handled that… maybe I would have defined a Unity axis for each joystick number and then queried unity for the joystick name to decide what type of controller it was, but at that point, it would get pretty cumbersome, and a different solution might work better.

As for an array of objects, since everything including arrays inherits from object, you can pass an object[] in as the tag. In your handlers, you just need to know to cast tag back to object[] similar to how I had to cast back to an AppCommand.

I hope that helps explain some of the rationale behind the tag.

Read more comments on GitHub >

github_iconTop Results From Across the Web

First person controller. rigidbody hides inherited member ...
Hi I am getting this 'First person controller. rigidbody hides inherited member UnityEngine.Component.rigidbody' Use the keyword if hiding ...
Read more >
Class EventSystem | Unity UI | 1.0.0
The EventSystem used to override UI Toolkit panel events and selection. If activeEventSystem is null, UI Toolkit panels will use current enabled ...
Read more >
Class ExtendedPointerEventData | Input System | 1.0.2
An extension to PointerEventData which makes additional data about the input event available. Inheritance. Object. UnityEngine.EventSystems.
Read more >
c# - Property hides inherited member
I have tried adding the override and virtual keywords, but that doesn't work. How can I make this warning go away? Edit. Here...
Read more >
Stupid Unity UI Navigation Tricks
Here's a few tricks you can use to get a little more control over controller or keyboard ... Selectable objects like buttons have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found