  In this paper we consider nonlinear elliptic PDEs of the type $$-\Delta_p
u+a(x)|u|^{p-2}u=|u|^{p^*-2}u \qquad \mbox{ in }\Omega,$$ where $1<p<N$ and
$p^*=Np/(N-p)$ is the critical Sobolev exponent, and allowing the asymptotic
behavior of the weight function $a$ to be sensitive to the direction. We
provide a unified variational approach to obtain existence of distinct
solutions in either the unbounded case $\Omega=\mathbb{R}^N$ or when $\Omega$
is a smooth bounded domain. A key point is a precise description of the
compactness properties of certain sequences of approximating solutions
(Palais-Smale sequences), for which we use novel observations on nonexistence
in certain regimes. Most of our main results are new in the case of the
classical Laplace operator, $p=2$.
