I’m trying to allow the player character to jump upwards through a platform but not fall once they exit it. I’m having trouble enabling the other object’s trigger. What am I doing wrong?
function OnTrigger2DExitD(coll: Collider2D) {
coll.GetComponent.<Collider2D>().isTrigger = false;
}
I don’t think this is the right way to go. If your player goes through your platform without ending up totally above it, you will set trigger to false even though your player is still below it. Same problem if the player goes through the platform and lands on it, but then goes down by another way: he will not be able to go through another time.
I would recommend you to either use the PlatformEffector integrated in Unity or write a simply script which sets trigger to true / false depending on whether the player is above the platform or not.
Looks like the name of the function should be OnTriggerExit2D. Check here.