Plz help with my Update with the same parameter

So I was using Unity 3D FPS Movement tutorial because im really new but my Update code thing says its with the same parameter so it wont let me test and I dont understand, heres my code

THIS WAS FIXED

  • using System.Collections;
  • using System.Collections.Generic;
  • using UnityEngine;
    • public class FPSMovement : MonoBehaviour
  • {
  • Rigidbody rb;
  • [SerializeField] float speed;
  • void Start()
  • {
  • rb = GetComponent();
  • }
  • // Start is called before the first frame update
  • void Update()
  • {
  • float x = Input.GetAxisRaw(“Horizontal”);
  • float z = Input.GetAxisRaw(“Vertical”);
  • Vector3 moveBy = transform.right * x + transform.forward * z;
  • rb.MovePosition(transform.position + moveBy.normalized * speed * Time.deltaTime);
  • }
  • // Update is called once per frame
  • void Update()
  • {
    • }
  • }

Unity 3D FPS Movement (Beginner Friendly Tutorial) | Craft Games

You’ve got two methods named “Update()” which take the same parameters. There can only be one. Since the second one doesn’t have anything in it, just delete lines 22 through 25.

Note that this isn’t a Unity specific issue, it is a standard C# language feature. You can’t have two methods/functions with the same name and parameters, because the compiler will have no way of telling them apart. It would be like if two houses on the same street had the same address number, what is the postal worker to do when delivering?

1 Like

Thank you alot! it worked so now I can continue