The error messages say
'Assets/Scripts/PlayerMovement.cs(5,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'PlayerMovement' Assets/Scripts/PlayerMovement.cs(12,10): error CS0111: Type 'PlayerMovement' already defines a member called 'Start' with the same parameter types Assets/Scripts/PlayerMovement.cs(18,10): error CS0111: Type 'PlayerMovement' already defines a member called 'Update' with the same parameter types'
Here's my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
Rigidbody rb;
[SerializeField] float movementSpeed = 6f;
[SerializeField] float jumpForce = 5f;
[SerializeField] Transform groundCheck;
[SerializeField] LayerMask ground;
// Start is called before the first frame update
void Start() {
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
rb.velocity = new Vector3(horizontalInput * movementSpeed, rb.velocity.y, verticalInput * movementSpeed);
if (Input.GetButtonDown("Jump")) {
rb.velocity = new Vector3(rb.velocity.x, jumpForce, rb.velocity.z);
}
}
bool IsGrounded() {
Physics.CheckSphere(groundCheck.position, .1f, ground);
}
}
How can I fix this? This is the only script in my project. I've looked through all similar questions and nothing has helped. I'm a beginner.