public class Player : MonoBehavior
{
//anything that has the enemy script attached to it
public Enemy[] enemies;
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
ChangeColour();
}
}
private void ChangeColour()
{
foreach (var enemy in enemies)
{
enemy.GetComponent<Renderer>().material.color = Color.red;
}
}