I'm stuck with a FPC script in unity

I’ve been trying to get this script to work and you guys already helped to fix a few errors, but now I can’t figure out what these new errors mean (I’m quite new to coding)

The script is the following:
Site

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{

   [SerializeField] Transform playerCamera = null;
   [SerializeField] float mouseSensitivity = 3.5f;
   [SerializeField] float walkSpeed = 6.0f;
   [SerializeField] float gravity = -13.0f;
   [SerializeField] [Range(0.0f, 0.5f)] float moveSmoothTime = 0.3f;
   [SerializeField] [Range(0.0f, 0.5f)] float mouseSmoothTime = 0.03f;

   [SerializeField] bool lockCursor = true;

   [SerializeField] private AnimationCurve jumpFallOff;
   [SerializeField] private float jumpMultiplier;
   [SerializeField] private KeyCode jumpKey;

   private bool isJumping;


   float cameraPitch = 0.0f;
   float velocityY = 0.0f;
   CharacterController controller = null;

   Vector2 currentDir = Vector2.zero;
   Vector2 currentDirVelocity = Vector2.zero;

   Vector2 currentMouseDelta = Vector2.zero;
   Vector2 currentMouseDeltaVelocity = Vector2.zero;

   // Start is called before the first frame update
   void Start()
   {
       controller = GetComponent<CharacterController>();
       if (lockCursor)
       {
           Cursor.lockState = CursorLockMode.Locked;
           Cursor.visible = false;
       }
   }

   // Update is called once per frame
   void Update()
   {
       UpdateMouseLook();
       UpdateMovement();
   }

   void UpdateMouseLook()
   {
       Vector2 targetMouseDelta = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));

       currentMouseDelta = Vector2.SmoothDamp(currentMouseDelta, targetMouseDelta, ref currentMouseDeltaVelocity, moveSmoothTime);

       cameraPitch -= currentMouseDelta.y * mouseSensitivity;

       cameraPitch = Mathf.Clamp(cameraPitch, -90.0f, 90.0f);

       playerCamera.localEulerAngles = Vector3.right * cameraPitch;

       transform.Rotate(Vector3.up * currentMouseDelta.x * mouseSensitivity);
   }

   void UpdateMovement()
   {
       Vector2 targetDir = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
       targetDir.Normalize();

       currentDir = Vector2.SmoothDamp(currentDir, targetDir, ref currentDirVelocity, moveSmoothTime);

       if (controller.isGrounded)
           velocityY = 0.0f;

       velocityY += gravity * Time.deltaTime;

       Vector3 velocity = (transform.forward * currentDir.y + transform.right * currentDir.x) * walkSpeed + Vector3.up * velocityY;

       controller.Move(velocity * Time.deltaTime);

       JumpInput();
   }
   private void JumpInput()
   {
       if (Input.GetKeyDown(jumpKey) && !isJumping)
       {
           isJumping = true;
           StartCoroutine(JumpEvent());
       }
   }

   private IEnumerator JumpEvent()
   {
       float timeInAir = 0.0f;

       do
       {
           float jumpForce = jumpFallOff.Evaluate(timeInAir);
           controller.Move(Vector3.up * jumpForce * jumpMultiplier * time.deltaTime);
           timeInAir += timeInAir.deltaTime;
           yield return null;
       } while (!controller.isGrounded && controller.collisionFlags != CollisionFlags.Above);

       isJumping = false;
   }
}

and these are the errors I’m getting:

Assets_Scripts\PlayerController.cs(101,71): error CS0103: The name ‘time’ does not exist in the current context

Assets_Scripts\PlayerController.cs(102,36): error CS1061: ‘float’ does not contain a definition for ‘deltaTime’ and no accessible extension method ‘deltaTime’ accepting a first argument of type ‘float’ could be found (are you missing a using directive or an assembly reference?)

Thanks for the help!

These are just typos… the computer is telling you how to fix your typos.

The complete error message contains everything you need to know to fix the error yourself.

C# is case sensitive: time is not the same as Time

The important parts of the error message are:

  • the description of the error itself (google this; you are NEVER the first one!)
  • the file it occurred in (critical!)
  • the line number and character position (the two numbers in parentheses)
  • also possibly useful is the stack trace (all the lines of text in the lower console window)

Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.

All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.

Remember: NOBODY here memorizes error codes. That’s not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

If you would prefer something more full-featured here is a super-basic starter prototype FPS based on Character Controller (BasicFPCC):

https://discussions.unity.com/t/855344

That one has run, walk, jump, slide, crouch… it’s crazy-nutty!!