Unity检测多个层级

  1<< 要检测的层 

  Vector3 _pos  = Vector3.down;
        if (Physics.SphereCast(_pos, 0.5f, Vector3.down, out RaycastHit hitInfo, 100, 1 << LayerMask.NameToLayer("Entity") | 1 <<  LayerMask.NameToLayer("Entity2"), QueryTriggerInteraction.Ignore))

猜你喜欢

转载自blog.csdn.net/LM514104/article/details/118861271
今日推荐