• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by InfernalMajesty89 · Nov 06, 2020 at 05:54 PM · state-machinecallbackinput managerbindingactionscript

How do I call InputActions & ActionMap in player code script when I have multiple binding group schemes? with Input System 1.0?

The tutorials and manual go into great detail about mapping bindings, but naturally there are many ways to implement the inputaction scheme groups, and unity seems content to just say call a code snippet for each action in the component. But if you are trying to self-teach coding, you are left to track down the esoteric advanced implementation techniques on your own. I am pressed for time and money, but willing and able to learn; I just don't know where to look sometimes and each new topic calls for comparing dozens of sources from right but skeletal to dry and dense to wrong but compelling.

Does one declare private InputActions.ActionMap for send messages & invoke events? In 1.0, the actionmap is not recognized (i guess because it's considered a struct?) and ActionMapActions is not valid as a method, as in

var _controller = InputActions.JetPackGM;

_controller.Move.started += OnMove();

I aimed to invoke events as code snippets in the component or c# events so the script doesn't even have to be attached to a game object, because I think a state/command pattern is going to be useful for expanding character skillsets/customization.

I am using set callbacks, and not sure if i'm implementing the class correctly anyway, as my template is a mashup of an official tutorial package using the old system, and a half-built strategy-pattern with the new input system; i.e. one uses an instance of the playerinputactions class being constructed as a protected static then made public as an instance, (while also implementing hash id's which seem like something i'd like, i want to pack functionality and optimization because I'm concerned the physics could get expensive) and the other uses a single action map. But I have a different map for civilian mode, gliding/fighting, and piloting vehicles.

Then there are hash id's, binding groups, scheme, interfaces, overloads, within this autogen class.

Also, apparently between 0.9 and 1.0 the autogenerated input actions class format has changed enough that I can't call IA. without calling .Action, (which I want to avoid because I already wrote a half dozen controls. I had this script working twice!! And then decided to update or fix a flag.) The first is considered a class, the second a struct, or considered a method, thus the former is flagged as empty and the second is not allowed.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by InfernalMajesty89 · Nov 06, 2020 at 09:39 PM

I have a soft solution, declaring variable before methods and then instantiating in Awake function. In time i'll learn more code principles and discover a more elegant, flexible, stable solution. https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/api/UnityEngine.InputSystem.InputActionMap.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

139 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

State machine callbacks not being called on mobile iOS? 1 Answer

Animator unable to properly transition between Animation Clips 1 Answer

Transition in state, which does not exist 1 Answer

Switch animation state while keeping animation timing 0 Answers

Issue with animator not working when key is pressed - Script and Animator communication - 2D - MissingComponentException 3 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges