InputBinder
                                
                                 InputBinder copied to clipboard
                                
                                    InputBinder copied to clipboard
                            
                            
                            
                        how are performances?
getaxis (string) allocates a lot so i was wondering how this thing compares
It uses GetAxis(string) internally but string is only allocated when the binding is created so it should be better than calling GetAxis(“Jump”) in every update for example.
Best to give it a try and profile it to see what the reality is though since I haven’t used this for quite some time.
Thanks man, trying it nao
so I'm reading your code, GetAxis gets called every frame like mine, it's just that you keep the string in a variable, so that means that the each frame allocation I'm getting comes from inlining "string" vs having a string variable?
Yep, that should be the case. If you define your input name string as an constant instance variable in your component you should get similar behaviour.
Also if you haven’t yet check out the new Unity input system. You should be able to get it from the Unity package manager. It’s going to be the future standard way to do input it seems and it’s pretty cool.
In my tests GetAxis("string") vs GetAxis(aString) makes no difference