Basically I want to use an OverlapSphere that can only collide with two layers named “GroundEnemy” and “FlyingEnemy”. I know that if I only want one layer, I could use…
1 << LayerMask.NameToLayer(“GroundEnemy”)
And it would only hit GroundEnemy. But I want it to only be able to hit FlyingEnemy as well as GroundEnemy.
int grnd = 1 << LayerMask.NameToLayer("GroundEnemy");
int fly = 1 << LayerMask.NameToLayer("FlyingEnemy");
int mask = grnd | fly;
plus would “technically” work, but if you have 2 masks that you want to stick together… and both share the same layer already… + will double them up and make the next layer up from it. Boolean OR doesn’t have this issue.