void Update()
{
Vector3 ya = joystick.Direction;
x = joystick.Horizontal;
forceSlider.value = force;
if (Input.GetMouseButton(1))
{
force += 5f;
}
if (Input.GetMouseButtonUp(1))
{
//The ya variable is always reset when I let go of the joystick
//How do I keep the the previous value when I let go of the Joystick??
rb.AddForce(x,0,0 * force);
force = 0f;
}
}
The x values always reset when I let go of the joystick, how do I keep the the previous value when I let go of the Joystick??