TITLE: Topological Euler number of a singular variety
QUESTION [5 upvotes]: Let $X$ be a projective variety over $\mathbb{C}$. Is there a way to define some number $\tilde{\chi}(X)\in \mathbb{Z}$ satisfying both of the following two properties?

$\boldsymbol{(1)} \;$ When $X$ is smooth, $\tilde{\chi}(X)=\chi(X)$, where $\chi(X)$ is the usual Euler number of $X$ (as a topological space).
$\boldsymbol{(2)} \;$ $\tilde{\chi}(X)$ is invariant under deformation,  i.e. if we have a family of variety over a connected base $B$, then any two fibers have the same $\tilde{\chi}$.

If I consider an affine variety (still over $\mathbb{C}$) instead of a projective variety, then what is the answer to the corresponding question?

REPLY [13 votes]: The following example shows that the answer to abx's down-to-earth question 

Is the Euler number of the general fiber independent of the smoothing?

is in general no.
Take $X \subset \mathbb{P}^5$, the cone over a rational normal curve $C_4 \subset \mathbb{P}^4$. It is well-known that $X$ admits two differents smoothings: a $\mathbb{Q}$-Gorenstein smoothing  whose general fibre isomorphic to $\mathbb{P}^2$ and a non-$\mathbb{Q}$-Gorenstein smoothing whose general fibre is isomorophic to $\mathbb{P}^1 \times \mathbb{P}^1$, see
for instance this MathOverflow question and the corresponding answers.
In the first case, the topological Euler number of the smooth fibre is $3$, whereas in the second case it is $4$. 
So, at least for varieties that are not $\mathbb{Q}$-Gorenstein, the topological Euler number of the general fibre actually depends on the smoothing we are choosing.