Problem with Is trigger on platforms

Hello, so I’m making a 2d game that consists of jumping on platforms, the problem is, I need to have the platforms set on " Is Trigger " which makes the Character fall through the platform instead. How can I keep the Is Trigger as the character can stay and jump from the platform?

Any ideas or tips will be greatly appreciated, thank you for taking your time to read this post!

I think what you want is a platform effector: https://unity3d.com/learn/tutorials/modules/beginner/5-tutorials/surface-and-platform-effector-2d

Thank you for your time but I tried and did not work :confused: I’m currently trying to find a solution, I will post it if I will find it!

You could use (set IsTrigger to false) OnCollisionEnter2D (Unity - Scripting API: MonoBehaviour.OnCollisionEnter2D(Collision2D)) if you want to know if a GameObject hits the collider.

Or add 2 colliders into the same GameObject without set as IsTrigger while the other is not.

Or have another GameObject with a collider component attached to it.

If the player passes right through it then try to use on trigger enter to start whatever you are doing with it & use on trigger exit to then toggle the istrigger check box to off. Then when the player falls back down it should be a normal collider that they are standing on. The only issue with this is if they fail the jump but hit the collider they won’t be able to try the jump again as it will be a solid block, but you would’ve had the same issue anyway with your trigger having already started whatever you had it doing.

I’m sort of new to Unity, can you explain it a bit in more details? Thank you for your time!

Unity has OnTriggerEnter2D but you also have OnTriggerStay2D & OnTriggerExit2D. As you’ve noticed, setting collides as triggers makes means they aren’t solid but you’ve also said you need to use OnTrigger so you are obviously using it to cause something else to happen. The effector was made to let people make platforms that players can jump up through from underneath but stand on when in top but you said you can’t use those. I actually think you can as whatever you are doing with ontrigger could probably be done with oncollision but going with a different solution what you could try is using onTrigger like you are already & also using ontriggerexit. On trigger exit will only run when you leave the trigger area, so if the player jumps up through the platform, & continues jumping so they are above the platform & outside the collider then ontriggerexit will run & you can use code to remove the istrigger check that you had turned on in the platform. This means when the player fallen back towards the platform it will now be solid & no longer a trigger.

How new are you to Unity? It could pay to run through the 2D tutorials so you can see what they do, it may help with giving ideas on different ways to do things.

How do I exactly write the sentance (set IsTrigger to false) OnCollisionEnter2D in a script? Sorry I’m kind of confused, thank you for your reply!

The thing is I’m using a small asset and I don’t need him to jump on the platform from underneath, the problem is that I added a timer to the platform, that is supposed to fall after a while that the character lands on it. If the isTrigger is on, the player passes through when I try to land him on the platform, and when the isTrigger is off, the player doesn’t fall through it, but it breaks my timer script for the platform because it uses the isTrigger on in order for the timer to start when the character touches the platform, any solutions? I have trying different ways and I still didn’t find a solution yet, thank you for taking your time to answer on this thread!

Try it if you change your trigger script so it starts oncollision instead