Question by
Sagyo · Nov 03, 2018 at 04:22 AM ·
performance optimizationontriggerstaycomparetag
CompareTag vs gameObject for best perfmormance?
I know that probably the difference is very small.
But is it faster to compare the tag or the object itself for OnTriggerStay2D()
?
In this case:
if (col.gameObject == Player.player)
vs if (col.gameObject.CompareTag("Player"))
.
Where player is a static GameObject
from Player class. I'd bet for CompareTag()
but not really sure.
Thanks in advance.
Comment