//when enemy is not seen any more the enemy is moved public void OnBecameInvisible() { if (generator != null) { generator.MoveEnemy(transform); } }