controller.collisionFlags & CollisionFlags.Sides Not working

If I use “if(controller.collisionFlags & CollisionFlags.Sides)” it gives me the error: “Cannot implicitly convert type UnityEngine.CollisionFlags' to bool’”, but if I use “if(controller.collisionFlags == CollisionFlags.Sides)” it works fine. But that’s not what I want, because I want it to detect it whether it is touching the ground also.

I am guessing that you’re using C#, in which case, to do a bitwise operation on a bitmask, like collisionFlags are, you’d use:

if ((controller.collisionFlags & CollisionFlags.Sides) != 0)

As in this thread

You’re using bitwise and. Use &&.