I tried with text in world space and make it rotate to camera but it is visible that text is rotating to camera, it not like like part of UI, also I want to text stay always on the same size, not dependent of camera position.
How can I make something like this like on the video?
This behaviour can be also described as behaviour of camera gizmo icon in editor etc. but I want it without scaling when camera is nearer like “3D icons” turned off (in “gizmo” tab).
You could use a Canvas that is set to Overlay and in a script use Camera.WorldToViewportPoint to check if the object position is on screen at any time.
If it is (if both x and y are between 0 and 1), then you can set the Text position to the Vector your check returned.
Since the Vector is Screen Space and not World Space, you position the Text at the exact position the object is rendered on screen.
Of course this would result in overlapping texts if there are multiple objects close to each other in screen space, depending on your text size and similar factors.
You could do simple Vector3.Distance checks, or Physics.RayCast to deal with that if it occurs.