Serializefield пишется с маленькой буквы: SerializeField
vektor3 - неверный тип данных. Правильно: Vector3
fixedUpdate - неверный метод. Правильно: FixedUpdate
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class player : MonoBehaviour
{
[SerializeField] KeyCode keyOne;
[SerializeField] KeyCode keyTwo;
[SerializeField] Vector3 moveDirection;
private void FixedUpdate()
{
if (Input.GetKey(keyOne))
{
GetComponent().velocity += moveDirection;
}
if (Input.GetKey(keyTwo))
{
GetComponent().velocity -= moveDirection;
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class player : MonoBehaviour
{
[Serializefield] KeyCode keyOne;
[Serializefield] KeyCode keyTwo;
[Serializefield] vektor3 moveDirection;
private void fixedUpdate()
{
if (Input.GetKey(keyOne))
{
GetComponent<Rigidbody>().velocity += moveDirection;
}
if (Input.GetKey(keyTwo))
{
GetComponent<Rigidbody>().velocity -= moveDirection;
}
}
}