Hi,
I am actually working in an action/platformer.
I prototyped a falling platform, but it didn’t work as expected.
My platform is composed of a single game object, with two colliders: the first one is used to act like a proper collider, and the second one, a trigger collider, is a small box on top of the “normal” collider.
I did that so the platform did not self-destroy if the player hit it from behind.
I have also a script attach to it, which will launch a Coroutine if the function OnTriggerEnter2D is called.
My player’s collider is a trigger.
After some debug, it seems that the function OnTriggerEnter2D is called when the player hits the non-trigger collider. It happens even when I remove all trigger from my platform.
When you have a trigger on either object that is colliding, OnTriggerEnter functions from any script that is attached to EITHER object get called. So since your player is a trigger, when the player makes contact with the collider you call OnTriggerEnter on both your player’s scripts AND the scripts on your platform.
Your new problem would then be figuring out how to detect which side of the box you collided on so that you can execute your code only when it contacts from whatever side you want it to.
There is the simple option where you make two objects connected into one GameObject with different colliders and only one of those objects has the coroutine inducing script (which would need to be edited to function on both objects).
Or probably a better solution would be to look into raycasting and using that to determine the sides your character hit from.
This is a link to another question that explains how to use raycasting for the solution: