Let $M$ be the coarse moduli space of smooth connected hypersurfaces of degree $d$ in some fixed smooth projective variety $X$.

If $X$ is projective space, it is easy to see that $M$ is connected. One simply notes that $tF +(1-t)G = 0$ connects the hypersurfaces $F=0$ and $G=0$, where $t$ is a coordinate function on $\mathbb A^1$.

Does this argument also work to show that $M$ is connected when $X$ is not necessarily projective space?