Distance Text
v1.0
Last updated
v1.0
Last updated
The Distance Text component can be attached to an icon prefab that also has a Overlay Icon component on it. Check the Demo Goal Target in the demo scene to see this in action.
In the demo scene, the Demo Goal Target
object has a Tracked Target Overlay component, with the special icon prefabs assigned in the Custom Icon Prefabs fields.
The Northstar Icon Distance
prefab has a TextMeshPro text object, which will display the distance to the target, from the player.
The Options section of the Distance Text component allows you to cusomize how this text is displayed.
When Override Color is true, you can set the specific color for the distance text.
Match Icon Opacity and Match Icon Size will set the opacity and size based on the opacity and size of the icon itself, which may be modified due to the distance from the player. When false, the settings in the icon prefab are used.
Here you can customize how the numbers will appear. There are examples listed so you can visualize how they are displayed at various values, without needing to test in play mode.
By default, the values are displayed in meters. However, the DistanceText
class has virtual members, so you can override the various methods to customize this if your game needs to display distance differently.
You can optionally set the Y Position offset for these overlay systems