Ways to detect 2D collision other than OnCollisionEnter2D

后端 未结 2 1607
执念已碎
执念已碎 2020-12-07 06:31

This might come off as a stupid question, but in an if statement, is it possible to check if the object is currently colliding with another object?

Here is what I ha

2条回答
  •  旧巷少年郎
    2020-12-07 07:03

    Maybe what you are looking for is the OnCollisionStay method, this one will fire as long as they are touching each other.

    There is some more info in the link here: https://docs.unity3d.com/ScriptReference/Collider2D.OnCollisionStay2D.html

提交回复
热议问题