Regarding pooling, you can dynamically increase and decrease reusable pool size. Trim the pool size every now and then to keep its size in check.
Is there any way I can make it always
rotate to face the camera, but stay
with the hit actor location-wise?
Also a problem if the enemy moves away, eh? 2 options here:
- track each widget every frame, projecting world to screen during tick, sounds expensive
edit: if you look at the bottom image in this post, you’ll see that the widget position is being updated during tick, the only thing that would need adding here is the screen location (deprojected world location) of the enemy over whom the text should display.
or
- give each enemy a widget of their own, it would have a small canvas, and track that canvas only. Rather than adding the floating text to the viewport directly, add it to that canvas instead. Essentially, you’d have each enemy drag a canvas with them. And the floating text no longer needs to worry about world coordinates at all - it will use local canvas positioning instead.