How can I implement UI buttons in the input manager?
For example, how can I replace the key “right” in the input manager with my UI buttons?
Where you have your if(Input… code with a UI button you just create a script and have a public function e.g.
public void MoveRight()
{
// depending on you game do the move code here
// or set a bool to true moveMeRight = true and in Update
// if(moveMeRight)
// Do your code here
}
Then drag that script onto your button, highlight the button and click + in the OnClick area.
A slot appears so drag your button onto it, the button contains the script so in the dropdown select MyScriptName → MoveRight
You might want different functionality than a click though so you can also Add Component → Event Trigger
From there you could add a PointerDown event to set that bool I mentioned and PointerUp that calls another function in that script called StopRight to set the bool to false. That way you keep moving right until you lift the pointer.