简体   繁体   English

Unity的“新输入系统:”通过鼠标点击取消“PerformInteractiveRebinding”

[英]Unity's "New Input System:" Cancel "PerformInteractiveRebinding" with a Mouse Click

Is there a way to cancel "PerformInteractiveRebinding" with the click of the mouse?有没有办法通过单击鼠标取消“PerformInteractiveRebinding”?

I'm having some trouble with Unity's "new" input system.我在使用 Unity 的“新”输入系统时遇到了一些问题。 What I have works fine until I start keybinding another key, thus activating two "PerformInteractiveRebinding"s at the same time.在我开始对另一个键进行键绑定之前,我所拥有的一切正常,从而同时激活了两个“PerformInteractiveRebinding”。 I pressume that I can implement what I need with an input such as a mouse click, but I don't know the terminology to do it.我认为我可以通过鼠标点击等输入来实现我需要的东西,但我不知道这样做的术语。

Here's what the code contains:以下是代码包含的内容:

`rebindingOperation = DMovement.action.PerformInteractiveRebinding()`
`.withControlsExcluding("Mouse")`
`.OnMatchWaitForAnother(0.1f)`
`.OnComplete(operation => RebindingComplete())`
`.Start();

Thank you for your interest, and hope you have a good day!感谢您的关注,希望您有美好的一天!

Discovered the terminology: Here's my updated code for anyone needing it:发现术语:这是我为任何需要它的人更新的代码:

`rebindingOperation = DMovement.action.PerformInteractiveRebinding()
`    .withControlsExcluding("Mouse")
`    .WithCancellingThrough("/<Mouse>/leftButton/")
`    .OnMatchWaitForAnother(0.1f)
`    .OnCancel(operation => OnCancellation())
`    .OnComplete(operation => RebindingComplete())
`    .Start();

Cheers Gents!绅士们干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM