I have around 10-20 enemies that have health bars and I only want to draw the health bars if they are on screen to save performance. Can someone please tell me if it’s a better idea to use OnBecameVisible or
WorldToScreenPoint in this case? If I use WorldToScreenPoint I will probably check it 2-5 times every frame.
In any case like this, the best answer is always “profile both and see what happens!”
I’m pretty sure that OnBecameVisible will be faster, simply because it involves less redundancy. The pre-rendering process (culling) already does a bunch of similar math, and OnBecameInvisible is called as a side effect of that math, so it should be nearly free.