MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Input action references are ill-defined

Open luis-valverde-ms opened this issue 7 years ago • 5 comments

Input actions are created by adding an entry to the table of input actions in the input actions profile. On creation, they get their ID set to their index in the table. When a user sets an input action in a script property, e.g. the pose action in a pointer, the ID gets serialized with it. This is problematic because:

  1. Removing and adding entries in the actions table may yield actions with the same ID
  2. Assuming that IDs are unique within an input actions profile, they don't uniquely identify actions across profiles. As we don't serialize a reference to the profile with the ID, when loading it you don't really know which action it originally referred to.

My preferred solution for this is to make actions assets (scriptable objects), so they can referred to from any scene in a well defined manner.

luis-valverde-ms avatar Apr 25 '19 15:04 luis-valverde-ms

I'd say this is a proposal not a bug.

We ended up with ids for performance, but I agree the scriptable object workflow sounds much more favorable.

StephenHodgson avatar Apr 25 '19 15:04 StephenHodgson

My intent here was to describe why the current ID based system is broken. In a nutshell, action IDs don't uniquely identify actions.

luis-valverde-ms avatar Apr 25 '19 15:04 luis-valverde-ms

It's not broken 😆 That's an opinion, and while I agree with you, is very rude and has negative connotations.

download

A better way to have opened this issue:

The Input Actions are currently setup as a struct with all the associated data.

To enable easier swap-ability, editing, and customization, it might be more beneficial to update these to be ScriptableObjects as well.

Requirements

  • [ ] Minimal changes to profile creation workflow
  • [ ] No noticeable performance differences between struct vs scriptable object
  • [ ] InputActions can be assigned by object reference, or guid.
  • [ ] Minimal code changes
  • [ ] Provide a way to convert already established /created InputAction profiles with structs to updated scriptable object references

Acceptance Criteria

  • [ ] Users can create new Input Actions via profile inspector
  • [ ] Users can assign Input Actions in Input Handler components
  • [ ] Devs can utilize Input Actions in code to validate input actions from event data

StephenHodgson avatar Apr 25 '19 15:04 StephenHodgson

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.

stale[bot] avatar Feb 20 '20 03:02 stale[bot]

This issue has been closed by an automated process because it is stale. If this is still an issue please add a new comment with more recent details and repro steps.

stale[bot] avatar Mar 21 '20 03:03 stale[bot]