Pointer Arrow - a simple component that sets the position of the arrow relative to the player and rotates it to the target.
Set Target From Inspector - allows you to select a target in the inspector.
Target - target link.
Set Player Manually - allows you to select a player in the inspector.
Player - player link.
Distance To Player - distance from the player where the arrow will be.
Reach Distance - distance to the target where we can consider that target reached.
Position Offset - arrow position offset.
Euler Angles Offset - arrow rotation offset.
Reach Action - the arrow action that will be performed when the target is reached.
On Reach() - event that will be called when the target is reached.
NOTICE: To auto find a player at the start, your player must have a Player tag. Position offset required to set the height of the arrow relative to the player.
QUESTIONS:
1. How to set target from script? - Get a link to the arrow in any way you like and to the target and set the Target value.
[SerializeField] private PointerArrow _arrow;
[SerializeField] private Transform _target;
private void Start()
{
_arrow.Target = _target;
}
2. How to subscribe OnReach event? - Get a link to the arrow in any way you like and subscribe event.
[SerializeField] private PointerArrow _arrow;
private void Start()
{
_arrow.OnReach.AddListener(OnReach);
}
private void OnReach()
{
//Do something...
}