Couple days ago I started with Unity and wanted to make a 2D game. My friend told me a good tutorials to get the basics called Brackeys and I started watching him. I started on his 2D movement and I installed the CharacterController he provided and followed his script and I copied exactly. I can get the left to right movement to work but jumping I can’t. I haven’t even started on the crouch yet. I shouldn’t have any issues and I get no errors is the console. I checked the project setting for “Jump” to have a key in it and it does. Any help??!!!
Video I used: 2D Movement in Unity (Tutorial) - YouTube (Has the character controller linked at the bottom of the video)
My player movement script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playermovement : MonoBehaviour {
public CharacterController2D controller;
public float runSpeed = 40f;
float horizontalMove = 0f;
public bool jump = false;
// Start is called before the first frame update
void Update()
{
horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
if (Input.GetButtonDown("Jump"))
{
jump = true;
}
}
void FixedUpdate ()
{
controller.Move(horizontalMove * Time.fixedDeltaTime, false, jump);
jump = false;
}
}