I’m having trouble with my jump script, I was using a video tutorial to make a 2D Metroidvania but the script in the video isn’t working, I’m using a newer version of unity than in the video so I’m not sure if that’s the problem. Also the only thing my visual studio is set to use is unity code, so maybe that’s a problem too? Here’s the link to the video and website:https://blog.terresquall.com/2023/04/creating-a-metroidvania-like-hollow-knight-part-1/
And here’s my code: (Sorry I don’t know how to show it properly so i’ll just copy and paste)
using UnityEngine;
public class PlayerControl : MonoBehaviour
{
[Header("Horizontal Movement Settings:")]
private Rigidbody2D rb;
[SerializeField] private float walkSpeed = 1;
private float xAxis;
[SerializeField] private float jumpForce = 45;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
GetInputs();
Move();
}
void GetInputs()
{
xAxis = Input.GetAxisRaw("Horizontal");
}
private void Move()
{
rb.linearVelocity = new Vector2(walkSpeed * xAxis, rb.linearVelocity.y);
}
}