You are trying to create a MonoBehaviour using the 'new' keyword.
Code Example - You are trying to create a MonoBehaviour using the 'new' keyword.
DetectPlayer dp;
private void Awake()
{
GameObject gameObject = new GameObject("DetectPlayer");
dp = gameObject.AddComponent<DetectPlayer>();
}