InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

CHANGE: Added isEnabledByDefault constructor option to generated action sets.

Open Walter-Hulsebos opened this issue 3 years ago • 1 comments

Description

Changed code generation of actions sets so they now have an optional isEnabledByDefault parameter and check in it's constructor. It will then automatically call .Enable() at the end of the constructor if set to true.

It's handy to have to ability to enable and disable all InputActionMaps. But there should be an option to have it enabled by default - for when you don't need the control and want to minimize code bloat.

Changes made

Please write down a short description of what changes were made.

  • Added optional isEnabledByDefault parameter to generated action set's C# class.
  • Added call to .Enable() at end of generated constructor when isEnabledByDefault is true.
  • Re-generated existing actions sets to implement the new functionality.

Notes

  • This requires no change to existing API apart from re-generating existing action sets. The constructor is functionally the same and sending the parameter is purely optional and defaults to false.

  • When using (isEnabledByDefault: true) it means you're restricted to where/when you're creating the action set; for instance you can't create it in Reset() anymore because it'll call .Enable() at a time it can't/shouldn't.

Checklist

Before review:

  • [x] Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
  • [x] Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • [ ] Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

Walter-Hulsebos avatar May 21 '21 22:05 Walter-Hulsebos

CLA assistant check
All committers have signed the CLA.

unity-cla-assistant avatar May 21 '21 22:05 unity-cla-assistant