I can't tell what's wrong with this script. I've tried putting all the variables in "void Start()" but nothing's worked. Please help. From what I can tell, everything in the update script isn't the problem.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MovementScript : MonoBehaviour{ }
{
Rigidbody PlayerCube;
float Jump = 1;
float Speed = 1;
void Update()
{
// All of this has the controls tilted 45 degrees. Deal with it for now.
if (Input.GetKey(KeyCode.W)) ;
{ PlayerCube.AddForce(0, 0, Speed * 5); }
if (Input.GetKey(KeyCode.S)) ;
{ PlayerCube.AddForce(0, 0, Speed * -5); }
if (Input.GetKey(KeyCode.A)) ;
{ PlayerCube.AddForce(Speed * 5, 0, 0); }
if (Input.GetKey(KeyCode.D)) ;
{ PlayerCube.AddForce(Speed * -5, 0, 0); }
if (Input.GetKeyDown(KeyCode.Space)) ;
{ PlayerCube.AddForce(0, (float)(Jump * 2.5), 0); }
}
}