2D jumping
i have my player and if followed a tutorial of movement but when it came to jumping it did nothing i did Debug.Log it says if prest it but nothing ...
public class playerMoveMent : MonoBehaviour {
public CharacterController2D controller;
public float runSpeed = 40f;
float horizontalMove = 0f;
bool jump = false;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
if (Input.GetButtonDown("Jump"))
{
Debug.Log( jump = true);
}
}
private void FixedUpdate()
{
//move character
controller.Move(horizontalMove * Time.fixedDeltaTime, false, jump);
jump = false;
}
} this is the code idk if i made something rong or its the Unity that i havent set something up please help thanks.
Comment