Show/Hide world space UI in certain conditions

Hi, I am new to UI and just started using it, is there a way other than colliders OnTriggerEnter() and OnTriggerExit() to make UI stuff appear above gameObjects like when the player gets close enough, and then make it disappear once they get too far away? Like start displaying it as long as the player

I can get the specific object and know which one should have stuff displayed above it, I just don’t know a way to do it so that it keeps appearing and disappearing as player gets closer/farther

I don’t know what UI framework you are using, but while OnTriggerEnter/Exit do work, they require extra colliders, and you may end up with some performance cost if there are too many colliders as they affect the overall physics systems.

As you develop your game, you will probably have a “game manager” of some sort that will contain the list of all players.
With this information, you could iterate over every entity and activate/deactivate the relevant UI by measuring the distance between the gameObjects manually instead of relying on the colliders for example.

Does that answer your question?