- Home /
Question by
giano574 · Oct 15, 2014 at 04:35 PM ·
collisiontriggerperformancepolygon collider 2d
Intersects() vs OnTriggerEnter2D performance
Hi. I am making a 2D game where I need to use triggers. However, I am unsure which method is best to use.
Method 1:
if (myTransform.renderer.bounds.Intersects(targetTransform.renderer.bounds))
{}
Method 2:
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == "Target")
{}
}
The latter method will be used with to detect collision between polygon2D and box2D/circle2D colliders. Can someone tell me, which method is the best to use?
Comment