gameobject.GetComponent().target is not working

I am setting the target for the AI agent at the runtime.
I attached the script on the AI Agent with “AI Character Control” script already attached on it.

But my command :

             gameobject.GetComponent<AICharacterControl>().target = player .transform;

to set the target showing error:

             the name "AICharacterControl" does not exixt in this context

I accessed the player using:


Can someone plz explain me how to set the target at runtime.

Complete code to set target:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class SetTarget : MonoBehaviour {

private GameObject player;

void Start () {
	player = GameObject.FindGameObjectWithTag ("Player");

// Update is called once per frame
void Update () {
	gameObject.GetComponent<AICharacterControl> ().target = player.transform;


Sorry for the previous Answer, It just removed some part of code.

Below is the Image that shows correct way to write that statement, we just need to provide the namespace for complete reference.