Here is what I have so far.
using UnityEngine;
using System.Collections;
public class PlayerControl : MonoBehaviour
{
public float movementSpeed = 10f;
void Update () {
if(Input.GetKey(KeyCode.UpArrow))
{
GetComponent<Rigidbody2D>().AddForce(new Vector2(0, 1) * movementSpeed * Time.deltaTime);
}
}
}
I want my object to move up when I press the up key and it seems to do nothing when I press the key. I’m new to Unity and I think I might have just missed something.