how can I enable and disable script on enemy object when I pressed specific button in unity
void OnButtonClick()
{
StartCoroutine(Cooldown());
GetComponent<FollowEnemy>().enabled = !GetComponent<FollowEnemy>().enabled;
}
GetComponent(MyScript).enabled = false;
Might be a good place to start,
For the button a Input.GetKey(KeyCode.Space), would do the trick.
You might need to experiment a bit, you can find more information here:
https://answers.unity.com/questions/26844/enabledisable-specific-components.html
Official documentation: