Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 teolul · Apr 03, 2021 at 01:50 PM · inputinputmanagercommandinputsrebound

Unity New Input System PerformInteractiveRebinding()

Does someone know why this code doesn't actually rebind the controls?

 [SerializeField] private InputActionReference jumpAction = null;
 [SerializeField] private GameObject startRebindObject = null;
 [SerializeField] private GameObject waitingForInputObject = null;
 
 private InputActionRebindingExtensions.RebindingOperation rebindingOperation;
 
 public void StartRebinding()
     {
         startRebindObject.SetActive(false);
         waitingForInputObject.SetActive(true);
 
         rebindingOperation = jumpAction.action.PerformInteractiveRebinding()
             .WithControlsExcluding("Mouse")
             .OnMatchWaitForAnother(0.1f)
             .OnComplete(operation => RebindComplete())
             .Start();
     }
 
     private void RebindComplete()
     {
         ChangeUI();
 
         rebindingOperation.Dispose();
 
         startRebindObject.SetActive(true);
         waitingForInputObject.SetActive(false);
     }

It updates the UI just fine it also saves it between sessions (thanks to other parts of the code I didn't post because they work), but it doesn't actually change the bind. If I initially jump with "Space" and I change it so that I can jump with "O" it still jumps with "Space" and "O" still doesn't do anything.

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 Bumpalump · Apr 09, 2021 at 11:34 PM

I'll assume you're like me using this tutorial: https://www.youtube.com/watch?v=dUCcZrPhwSo

First thing you're missing is that you cannot perform PerformInteractiveRebinding() on key that is active so you'll need to either switch to Action map that doesn't have the key you're rebinding like:

 playerController.SwitchCurrentActionMap("Menu");

or just disable the action

 rebindAction.action.Disable();

You can Enable it / Switch Action map in your OnComplete function.

Now if that isn't the problem you're having there's another option. Try setting up your Player Input like this: alt text

You probably used below code:

 void Awake()
 {
     controls = new InputMaster();
     controls.Gameplay.Tidy.performed += ctx => Tidy();
 }

To hook a hotkey performed into the function. When it's done in Awake changing the hotkey afterwards doesn't seem to work but if you remove Awake code and just setup it as I've shown in screenshot in Invoke Unity Events mode it'll work just fine.


unity.jpg (26.8 kB)
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.

Follow this Question

Answers Answers and Comments

148 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

HTC Vive XR Input not working 0 Answers

Current method of reading specific input action states in new system 2 Answers

Is there a way to detect a change in Control Scheme with the new Input System? 1 Answer

create default and customizable inputs 0 Answers

3D Input Issues regarding Two Player Game - When both Left Joysticks get moved, the movement glitches 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges