Player Distance Logic

This package gives you a script and widget that will show the player a distance to a specified target. This is useful for signposting players towards an objective in world, a location to search within or general guidance.

Installing the package

  1. Go to the community tab in the edior and search Player Distance Logic
  2. Click Install
  3. Drag the PlayerDistanceLogic to the Player template

Using the package
There are 2 ways that you can specify the target for the player. The first option is the property target that you can set as an entity in the world. This is good if the target isn’t going to chance during the course of the game and also if you want to set a default target.

The second option is to set it through code using the SetTarget(entity) function on the player. The entity that you pass to this function will be the players new target. You can use ClearTarget() to remove any current target from the player, which will automatically hide the UI.

There are a number of properties that come with this script to help define how you want this to work in your game. These include…

  • target - manually specify the target that we want the distance to
  • distanceMsg - this is already configured to work but can be changed to update how the distance appears in the UI
  • unit - display the distance in centimeters or meters
  • includeTargetName - should the UI display the name of the target (username if a player, friendlyName if there is one or just the entity name). If false then it’ll just say “TARGET”
  • hideDistanceAtProximity - should the distance be hidden if the player gets within a certain range of the target. Good for hide and seek games
  • showOnScreenPos - show the distance at the screen position of the target if it is being looked at


As always, any feedback/questions/issues should be dropped here or in the #looking-for-feedback channel on