unity не двигается объект
я недавно начал изучать юнити и попытался написать скрипт движения по памяти. но коробка просто не двигается. я пробовал разные методы, ни один не работает.
код:
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
public class move : MonoBehaviour
{
public float speed;
public float jumppower;
public bool onground;
private Vector2 moveDirection = Vector2.zero;
// Start is called before the first frame update
void Start()
{
speed = 5;
jumppower = 5;
onground = true;
}
// Update is called once per frame
void Update()
{
if (onground)
{
if (Input.GetKeyDown(KeyCode.D))
{
moveDirection.x = speed;
}
}
}
}