The bonus is not lost if the creature later becomes an attacker or blocker. The limitation is just there to prevent the effect from being used late in an attack.

Artwork
Loading artwork…
Unlikely Alliance
Alliances · #20 · EN
Nonfoil—Foil—
Card rules
1
: Target nonattacking, nonblocking creature gets +0/+2 until end of turn.
"Strange alliances are alliances still, and provide the same protection." —King Darien of Kjeldor
Uncommon · Illustrated by Phil Foglio
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
PreDH Legal
Premodern Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions