enemy moving script

So I made this script that is attached to an object with a boxcolider and rigidbody.
When the Player collides with the object(it collides with the player) it executes a script on an enemy, the script makes the enemy move constantly along the x-axis, But how do I make it run costantly?

I use transform.Translate (speed*Time.deltaTime,0,0);


the script on the enemy:

public class Boss : MonoBehaviour {
public float damage = 1f;
public float speed = 10;

// Use this for initialization
void Update () {

}

// Update is called once per frame
public void Run () {
transform.Translate (speed*Time.deltaTime,0,0); //move


the script on the object that checks for a collision:

public class RunTrigger : MonoBehaviour {
public Boss boss;
// Use this for initialization
void Start () {

}

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

}
void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag(“Player”)){
boss.Run();


What do you mean by “make it run constantly”? The code you have should already result in the enemy moving at a consistent speed whenever it has entered the trigger, but only for that one frame. What are you really trying to do?

Change your run function to be called Update. Then have trigger enter toggle a bool to chase the player. Or, use OnTriggerStay not OnTriggerEnter.