Please help me because I'm still a beginner. What's wrong with this code?

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

public class rotation : MonoBehaviour
{
public float rotationSpeed = 100f;
public detectionArea;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
             // Player detection.
         Collider[] player = Physics.OverlapSphere(detectionArea.position, detectionRange, playerLayer);
         if (player.Length > 0) 
         {
             // Player is inside area.
             gameObject.transform.RotateAround(new Vector3(0,0,1f),rotationSpeed*Time.deltaTime*0.2f);
             // Rotate object.
         } 
         else
         {
             // Player is far.
             gameObject.transform.RotateAround(new Vector3(0,0,0));

         }
    }
}

I can see a few thing wrong with that code, though I have no idea what it’s trying to accomplish.

  • detectionArea does not have a type in its declaration.
  • playerLayer is used without being declared