更新时间:2023-02-21 15:33:21
除了Kolink的答案,您的if
还在Boundary
的开头寻找Boundary(clone)
,而不是相反.我认为您正在寻找:
In addition to Kolink's answer, your if
is looking for Boundary(clone)
at the beginning of Boundary
, rather than the other way around. I think you're looking for:
if (hitFront.collider.gameObject.name.IndexOf(obstacles[i]) >= 0)