2. The sum of all real numbers $m$ that satisfy $(2-m)^{m^{2}-m-2}=1$ is ( ).
(A) 3
(B) 4
(C) 5
(D) 6
2. A.

When $2-m=1$, i.e., $m=1$, it satisfies the condition.
When $2-m=-1$, i.e., $m=3$,
$$
(2-m)^{m^{2}-m-2}=(-1)^{4}=1 \text{, }
$$

it satisfies the condition.
When $2-m \neq \pm 1$, i.e., $m \neq 1$ and $m \neq 3$, by the condition, $m^{2}-m-2=0$, and $2-m \neq 0$.
Solving gives $m=-1$.
Therefore, the sum is $1+3+(-1)=3$.