OnTriggerStay2D working only when player ISN'T moving

I’ve looked for this but I’ve only seen this question asked in the opposite, namely that OnTriggerStay or OnTriggerEnter is only working when their player IS moving. For my case, for some weird reason, my OnTriggerStay2D only works when my player ISN’T moving.

I’m trying to do knockback when the enemy hits a certain collider thats a little bit ahead of the player and the player is attacking. Both the enemy and the box collider ahead of the player are set to isTrigger. Here’s the code in the enemy when he collides:

void OnTriggerStay2D(Collider2D c)
{
	if (c.tag == "Player")
	{
		Player player = (Player)c.transform.parent.GetComponent<Player>();

		if (player.attacking)
		{
			Debug.Log ("Anybody home?");
			myRigidbody.AddForce(transform.InverseTransformDirection(c.transform.position - transform.position) * -500);
		}
	}

}

This code works fine for me in terms of knocking back the enemy, but it only works when the player is standing still.

Any help with this would be greatly appreciated!

use void OnTriggerStay only

Not the script, add Rigidbody to both the Player and the Trigger Collider and check kinematic on both I also set Collision Detection to continuous That should help out.