Error CS1519

Trying to create a collision wall, where I can enter through one side,
but can’t go through another one
I’m Getting Error CS1519,
I can fix it by adding a " ; ", on the end of this line > GameObject.GetComponent
But it creates a new error, I’m really new to this, so explaining why the error is here, and how should I type the script, would be blessful.

using UnityEngine;
using System.Collections;

public class CollisionWall : MonoBehaviour {

GameObject.GetComponent<BoxCollider>

// Update is called once per frame
	void update() {

	// Makes the Wall a non colision object.
	if (Input.GetKey (KeyCode.A)) {
		BoxCollider2D.enabled = false;
		Debug.Log("This is an Illusion");
		
	}

	else {
		BoxCollider2D.enabled = true;
		Debug.Log("This is a WALL");
	}

}
}

  • The line GameObject.GetComponent<BoxCollider> is imcomplete (missing ();) ,in the wrong place (not within any method) and starts with GameObject instead of gameObject or nothing. Better delete it
  • it’s uppercase void Update()
  • BoxCollider2D is the class you’re trying to access enabled from. If you wanted to access that from a BoxCollider2D component on the same GameObject, then its GetComponent<BoxCollider2D>().enabled