Best practice to get an entity with a specific component value from Monobehaviour.

Most of the time I need to get a single entity after a UI action. What is the best way of getting an entity that have a specific component value?

The answer is either:
Iterate through all entities with the component type and search for the value.
or
Your architecture is wrong and you need to take a step back and rethink how you are linking entities with your UI.

u can create a system require a singleton and in the onstartrunning method u can pass the component to mono

Dreaming is basically right.

However you can do the following, if some requirements are met.
-Use entity manager to add component to the target entities.
so in case you have have a spawner that spawns entities.
You can use that spawner to spawn an entity with a component.

-In some other case. Like lets say its a door. then add door component to the door entities.
-Now query that door component getting all the doors.
-Now from the 10 doors for example, search the right door.
if you only have one door, then the entity query returns that door.

If you want to separate the doors, then add different component to each and query that door component.

Its fast, but then again why would you want to do that?

Basically you could just use class and pick up the reference.

In short what you could do is a job that goes through every door and sorts them by distance. from the native array of doors sorted by distance to player pick the first one.

My approach is this: when you select entity send Entity reference to the GUI and cache it until unselected