So I’m going through the John Lemon’s Haunted Jaunt: 3d Beginner, and I’m stuck on the coding portion, i read everything it wanted me to, wrote everything it wanted me to and checked my code to what the code was on the tutorial and changed what was needed and there was errors. so I did research, didn’t help. I even copied the code that the tutorial showed and there were errors, so I’m stuck. Here’s my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float tunrSpeed = 20f;
Animator m_Animator;
Rigidbody m_Rigidbody;
Vector3 m_Movement;
Quaternion m_Rotation = Quaternion.identity;
void Start ()
{
m_Animator = GetComponent<m_Animator>();
m_Rigidbody = GetComponent<m_Rigidbody>();
}
void FixedUpdate ()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("vertical");
m_Movement.Set(horizontal, 0f, vertical);
m_Movement.Normalize();
bool hasHorizontalInput = !Mathf.Approximately(horizontal, 0f);
bool hasVerticalInput = !Mathf.Approximately(vertical, 0f);
bool isWalking = hasHorizontalInput || hasVerticalInput;
m_Animator.SetBool("IsWalking", isWalking);
Vector3 desiredForward = Vector3.RotateTowards(transform.forward, m_Movement, turnSpeed * Time.deltaTime, 0f);
m_Rotation = Quaternion.LookRotation(desiredForward);
}
void OnAnimatorMove ()
{
m_Rigidbody.MovePosition(m_Rigidbody.position + m_Movement * m_Animator.deltaPosition.magnitude);
m_Rigidbody.MoveRotation(m_Rotation);
}
}
the error codes are these:
Assets\Scripts\PlayerMovement.cs(5,14): error CS0101: The namespace ‘’ already contains a definition for ‘PlayerMovement’
Assets\script.cs(5,14): error CS0101: The namespace ‘’ already contains a definition for ‘PlayerMovement’
Assets\Scripts\PlayerMovement.cs(14,10): error CS0111: Type ‘PlayerMovement’ already defines a member called ‘Start’ with the same parameter types
Assets\script.cs(16,10): error CS0111: Type ‘PlayerMovement’ already defines a member called ‘Start’ with the same parameter types
Assets\script.cs(22,10): error CS0111: Type ‘PlayerMovement’ already defines a member called ‘FixedUpdate’ with the same parameter types
Assets\script.cs(41,10): error CS0111: Type ‘PlayerMovement’ already defines a member called ‘OnAnimatorMove’ with the same parameter types