Example 4 If real numbers $a, b$ satisfy the conditions
$$
a^{2}+b^{2}=1,|1-2 a+b|+2 a+1=b^{2}-a^{2} \text {, }
$$

then $a+b=$ $\qquad$
(2009, National Junior High School Mathematics Joint Competition)
Given $a^{2}+b^{2}=1$, we have
$$
b^{2}=1-a^{2} \text {, and }-1 \leqslant a \leqslant 1,-1 \leqslant b \leqslant 1 \text {. }
$$

From $|1-2 a+b|+2 a+1=b^{2}-a^{2}$, we get
$$
\begin{array}{l}
|1-2 a+b|=b^{2}-a^{2}-2 a-1 \\
=\left(1-a^{2}\right)-a^{2}-2 a-1=-2 a^{2}-2 a .
\end{array}
$$

Thus, $-2 a^{2}-2 a \geqslant 0 \Rightarrow-1 \leqslant a \leqslant 0$.
Hence, $1-2 a+b \geqslant 0$.
Therefore, $1-2 a+b=-2 a^{2}-2 a$, which means
$$
1+b=-2 a^{2}=-2\left(1-b^{2}\right) \text {. }
$$

Rearranging gives $2 b^{2}-b-3=0$.
Solving this, we get $b=-1$ (the other root $b=\frac{3}{2}$ is discarded).
Substituting $b=-1$ into $1+b=-2 a^{2}$, we get $a=0$.
Thus, $a+b=-1$.