So I have 3 platforms on a layer labelled "OneWayPlatform" when my player pressed W when they are hitting a ladder collision box I run this code
Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer("Default"), LayerMask.NameToLayer("OneWayPlatform"), true);
this now allows the player to move up and down the ladder while also ignoring the collisions between the player and the platforms, this allows the player to move above the platform and then continue on the new platform above. Now here is my problem. When my player presses S to move down the ladder it runs the same code above however my player can't move thought the platform, they first have to press S to start going down then press A or D to move a little to the left or right and then S can be used to move down. Looking at the code of my player it seems fine it doesn't seem to notice the collision has changed. Can anyone please help.
Here is a screenshot showing my player can't move down but Default layer is ignoring OneWayPlatform layer
Just a quick update, If I press the S key once go into the scene and untick the platform my player is standing on my S button works correctly. so why is it still checking for the collision?
Just to let anyone know I fixed it.
Basically what I had to do was when I press W or S to start my character climbing a ladder I targeted my box collider and circle collider I set them to be triggers and then unset them to be triggers and it works. I think Unity is trying to save on calculations so it thinks its in the right by not recalculating the collision detection but however it is wrong