IsTouchingLayers

Instead of

GetLayerMask("Ground");

, i did the following.

[SerializeField] private LayerMask groundLayer;

and then in the Jump Method

if (CrossPlatformInputManager.GetButtonDown("Jump") && myCollider.IsTouchingLayers(groundLayer))
{
    .....
}
1 Like

Did it work properly?

Yes, it works great, you can select in the inspector the layer you want to use.
Nice and easy, this way you cannot make a typo for the layer name.

Privacy & Terms