An ability that triggers when something "attacks and isn't blocked" triggers in the declare blockers step after blockers are declared if (1) that creature is attacking and (2) no creatures are declared to block it. It will trigger even if that creature was put onto the battlefield attacking rather than having been declared as an attacker in the declare attackers step.

Artwork
Loading artwork…
Eternal of Harsh Truths
Hour of Devastation · #34 · EN
Nonfoil—Foil—
Card rules
Afflict 2 (Whenever this creature becomes blocked, defending player loses 2 life.)
Whenever this creature attacks and isn't blocked, draw a card.
1/3
"If creating the Eternals was Bolas's plan here, what is his plan for the Eternals?" —Jace Beleren
Uncommon · Illustrated by Izzy
Format legality
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Pioneer Legal
Timeless Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Future Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
Afflict resolves before combat damage is dealt. If this loss of life brings a player to 0 life or less, that player loses the game immediately. A blocking creature with lifelink won't deal combat damage in time to save that player.
Afflict causes the defending player to lose life; it's not damage or combat damage.
If multiple creatures block a creature with afflict, afflict triggers only once.
If a creature is attacking a planeswalker, that planeswalker's controller is the defending player. If a creature is attacking a battle, that battle's protector is the defending player.