So only the fund's unrealized P&L matters.
That is why ppl don't want to buy mutual funds before the realized gain distribution.
Say you buy fund at $10 per share, next day fund distributes $1 realized gain per share, as a result, you get $1, price drops to $9 after distribution (NAV decrease by $1), you still have $1 + $9 = $10 in your accounts, but you have to pay taxt for $1, ends up you have a loss.