- Home /
Invert y axis on game configuration, how to?
some way to change the "+" to "-" sign in the game configuration ( http://docs.unity3d.com/Documentation/Images/manual/class-InputManager-1.jpg) I know I can change it in inspector but sometimes we have an inverted axis joystick like xbox 360's one and if you want to configure the axis to the d-pad, and not the stick, the y axis will be inverted. If we already detect if the axis is positive or not (inverted or straight) in the input menu configuration, why we cannot change it!? or is there any way??
Answer by iwaldrop · Dec 24, 2013 at 06:42 AM
You don't change the Input manager at runtime, you just invert the input according to user options. This is not a very optimal way to do it, but illustrates the point. Invert the input that you receive, don't invert the manager.
void Update()
{
float verticalInput = Input.GetAxis("Vertical") * (inverted ? -1 : 1);
}
I don't think you get the question, I asked if in the Input menu configuration, since we can see the "+" or "-" indicating if it is normal or reverse, if we can change it.
I don't think you understood the answer. :) I told you 'no, you don't change it like that'. You have a setting and invert it at runtime. You didn't post any code, so it's impossible to know what exactly it is that you're doing. For instance, can't tell if you're treating buttons as an axis or not.