How to return asset from custom user field In Craft 3, one of my 'User' fields is an assets type field with one selectable asset ('profilePicture').

I have routing setup to load my template when a url looks like:

domain.com/person/firstname-lastname


In my template I am getting the appropriate user with: 

{% set secondSegment = craft.request.getSegment(2) %}

{% set people = craft.users.group('family') %}

{% for person in people %}
    {% set personName = person.firstName|lower ~ "-" ~ person.lastName|lower %}
    {% if secondSegment == personName %}
        {% set currentUser = person %}
    {% endif %}
{% endfor %}


All that works - I can query most fields, but I can't work out how to get my asset.

Works:

{{ currentUser.myTextField }}


None of these work (returns nothing and no error):

1.

{{ currentUser.profilePicture[0].url }}


2.

{% set asset = currentUser.profilePicture.first() %}

{% if asset %}
    {{ asset.getUrl }}
{% endif %}


3.

{% for asset in currentUser.profilePicture %}
    {{ asset.getUrl }}
{% endfor %}
You have to make sure you enabled the option Assets in this volume have public urls in your volume settings at /admin/settings/assets/volumes/.

This checkbox is disabled by default thus your getUrl() function will always return an empty string/null.