C# error CS1624: The body of `Obstaclecollision.OnTriggerEnter(UnityEngine.Collider)' cannot be an iterator block because `void' is not an iterator interface type

I’m trying to slow down the player and then return him to normal speed after 1 second.
I tried adding a delay but it then gives this error.

error CS1624: The body of Obstaclecollision.OnTriggerEnter(UnityEngine.Collider)' cannot be an iterator block because void’ is not an iterator interface type

here’s my code

void OnTriggerEnter(Collider other)
{

	print("Collision detected with trigger object " + other.name);
	PlayerComponent playerComponent = other.gameObject.GetComponent<PlayerComponent> ();
	//checking if collided with player
	if (playerComponent) {
		playerComponent.Speed *= SlowDownPercentage;
		Destroy (gameObject);
		yield return new WaitForSeconds(1);
		playerComponent.Speed *= ReturnToNormalSpeed;
	}
}

I’m very new to scripting and programming so bare with me please.

You can fix the problem by changing the ‘void’ to IEnumerator. This does not work for all callbacks, but it does for OnTriggerEnter().