为什么unity说我的代码中存在编译器错误



所以,我开始学习团结,并尝试创建一个简单的playercontroller脚本,它看起来很好,我确信它会起作用,但团结说"所有编译器错误都必须在进入播放模式"之前修复;,所以我请你帮我找出这些编译器的错误,因为我看不到任何错误。提前感谢:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(PlayerPhysics))]
public class PlayerController : MonoBehaviour
{
// Player handling
public float speed = 8;
public float acceleration = 12;
private float currentSpeed;
private float targetSpeed;
private Vector2 amountToMove;
private PlayerPhysics playerPhysics;

// Start is called before the first frame update
void Start()
{
playerPhysics = GetComponent<PlayerPhysics>();
}
// Update is called once per frame
void Update()
{
targetSpeed = Input.GetAxisRaw("Horizontal") * speed;
currentSpeed = IncrementTowards(currentSpeed, targetSpeed, acceleration);
amountToMove = new Vector2(currentSpeed, 0);
playerPhysics.Move(amountToMove * time.deltaTime);
}
private float IncrementTowards(float n, float target, float a)
{
if (n == target)
{
return n;
}
else
{
float dir = Mathf.Sign(target - n);
n+= a * Time.deltaTime * dir;
return (dir == Mathf.Sign(target-n))? n: target;
}
}
}

还有PlayerPhysics脚本:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerPhysics : MonoBehaviour
{
public void Move(Vector2 moveAmount)
{
transform.Translate(moveAmount);
}
}

修复此处

playerPhysics.Move(amountToMove*time.deltaTime(;

time.deltaTime->Time.deltaTime

void Update()
{
targetSpeed = Input.GetAxisRaw("Horizontal") * speed;
currentSpeed = IncrementTowards(currentSpeed, targetSpeed, acceleration);
amountToMove = new Vector2(currentSpeed, 0);
playerPhysics.Move(amountToMove * time.deltaTime);
}

:(