AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Incontrol unity a b x y12/5/2023 ![]() I've tried to use the approach mentioned here, to look at the LastInputType on various PlayerActionSets, but there's a downside to that: it only fires when one of the specific PlayerActions in the PlayerActionSet is used. This seems like a fairly complicated way to try to answer what seems like a fairly simple question: Is the player currently using Keyboard & Mouse, or are they using a Controller? I'm trying to find a reliable way to determine that. I didn't handle every possible case, because I didn't need everything, but here's the code I wrote:Ĭlick to expand. Is there a general approach to making one binding take on the characteristics of another? Or do I need to test what concrete BindingSource type the object is, instantiate a new one, a manually assign all of the public properties?Įdit: I did end up just creating a utility method to return a "copy" of a binding, by newing up a binding and setting its values. It doesn't seem possible to clear the BoundTo field on the copy to avoid this. Unfortunately, that results in "Binding source is already bound to action" warnings. Instead, I'm instantiating a copy of my PlayerActionSet, and using ReplaceBinding to replace the binding with the copy. Because I don't want to reset every binding (only the keyboard bindings, or only the controller bindings) I can't use 'ResetBindings', since that would reset everything. On my input screen, I let the player reset the Keyboard inputs, or reset the Controller inputs, with two distinct buttons. ![]() I was wondering what the correct approach was for resetting some, but not all, bindings in a PlayerAction to a default state? For example, I have PlayerActions that have a mix of Keyboard bindings and Controller bindings.
0 Comments
Read More
Leave a Reply. |