Let $(G, n)$ be a pair where $G$ is an abelian group and $n \in \mathbb{N}$. Recall that an **Eilenberg-MacLane space** is a connected CW complex $X$ such that $\pi_r(X) = G$ if $r=n$ and $0$ otherwise. An Eilenberg-MacLane space is unique up to homotopy equivalence. A direct argument is given in Hatcher's book based on the Whitehead theorem (that a weak equivalence of CW complexes is a homotopy equivalence): one shows that there is always *an* Eilenberg-MacLane space of a given form (that starts with a wedge of $r$-spheres and then goes up). Then, one explicitly checks that given any Eilenberg-MacLane space, one can define a map from this one into the other one which induces an isomorphism on the homotopy group in dimension $n$, though. This relies on a particular construction of the Eilenberg-MacLane space, though.

Is there a more functorial way of seeing this?

One half of an approach is the following. We know that the Eilenberg-MacLane spaces represent the cohomology functors (with coefficients in $G$) on $CW_*$, the homotopy category of pointed CW complexes. This implies uniqueness.

But I don't think this is logically correct given the above constraint. Namely, the fact that *any* Eilenberg-MacLane space represents the cohomology functor relies, I think, on the fact that any two are homotopy equivalent. Namely, the proof I know of this fits the various $\{ K(G,n) \}$ into an $\Omega$-spectrum and then argues that they represent a cohomology theory which satisfies the dimension axiom, so is singular cohomology with coefficients. I don't see how it is obvious that *any* $K(G,n)$ can be fit into an $\Omega$-spectrum, though, without using the homotopy equivalence above.

any$K(A,n)$ $X$ that is a CW-complex, the inclusion of the $n-1$-skeleton $X^{(n-1)}$ into $X$ is nullhomotopic by obstruction theory, so we can replace $X$ by $X/X^{(n-1)}$ and then apply Hatcher's argument. This gives a homotopy equivalence between any two CW-complexes that are $K(A,n)$s, without passing through any particular special favorite $K(A,n)$. $\endgroup$