I am very new to Unity and C# and I was following a simple tutorial (2-3 years old) I used the exact same code as they did but the player (a ball) won’t even move left and right. Here is the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AddPlayerControlledVelocity : MonoBehaviour
{
[SerializeField]
Vector3 v3Force;
[SerializeField]
KeyCode keypositive;
[SerializeField]
KeyCode keynegative;
void FixedUpdate()
{
if (Input.GetKey(keypositive))
GetComponent<Rigidbody>().velocity += v3Force;
if (Input.GetKey(keypositive))
GetComponent<Rigidbody>().velocity -= v3Force;
}