Is there a way detect collisons with an object while also allowing the object to go through walls?

Is there a way detect collisons with an object while also allowing the object to go through walls?
I’m currently using BoxColliders for this, but this is causing the player to stick to walls and not detect slopes as ground. (I’ve tried raycasts, they didn’t work with my problem)

Not completly sure that you want to achive exactly but some things that can be done:

If you want to at all just register collisions but not have any physical interaction at all then tick the “Trigger” box on the collider and use the OnTriggerEnter callback instead of OnCollisionEnter

You can disable collisions for certain colliders using the IgnoreCollision function. (see documentation here)

If you want to be able to collide with certain objects and not with others it gets a bit more tricky:

In the phyics settings there is a collision matrix that defines which objects on certain layers will collide with other objects. So if you want to collide with certain objects A but not with B then put your moving object on a layer that has collisions enabled with A and not with B. This however will remove all interactions - so no detection of the collision at all.

Now lets assume that i understood you correctly that you want to have the following.
Your player is A. A has a collider and should be able to stand on ground. A should be able to move on the ground but collide with certain objects (B) but be able to move through certain objects (C).

In this case check out the collision matrix at the bottom of this documentation page on collisions.
There you can see that rigidbody colliders wich are not triggers will not trigger the OnTriggerEnter callback. So in this case your Character A would need 2 colliders with the same dimensions. One as trigger. One as normal collider. Then give B normal collision and C only triggers. This way you can get both - OnTriggerEnter without physical interactions (pass through C) and the possibility for physical interactions to be able to stand on B.

Let me know if that helps or if anything is unclear.

Thank you! The IgnoreCollision function is exactly what I was looking for.
I probably should have provided more information on my problem, I’ll be sure to word my questions better in the future.
I only have 1 point right now, I’d give you more if I could.