Everything below is defined over $\mathbb C$.


Let $T$ be a smooth affine variety, $\pi : \mathscr X \to T$ be a smooth family of smooth 
projective varieties, and $\mathcal F$ be a locally free coherent sheaf on $\mathscr X$.
As usual write $\mathscr X\_t$ for the fiber of $\pi$ over $t$ and $\mathcal F\_t$ for the 
restriction of $\mathcal F$ at it. 


Suppose $h^0(\mathscr X\_t, \mathcal F\_t) >0 $ for every $t \in T$ and fix $t\_0 \in T$.
Can I conclude the existence of a non-zero section of $\mathcal F\_{t\_0}$ which extends
to a section of $\mathcal F$ on a neighborhood of $\mathscr X\_{t\_0}$?


**Clarification**: By a smooth family of smooth projective varieties, I mean that $\mathscr X$ is smooth, $\pi$ is a submersion, and the fibers are smooth and connected. In particular, the family is topologically trivial. Also, I do not need a section at an affine neighborhood of $\mathscr X\_{t\_0}$: an analytic neighborhood would suffice.



Existence of non-zero sections
No, this is not true. Here is the simplest example. Take $T = \mathbb A^2$, $X = \mathbb A^2 \times \mathbb P^1$. The morphims $\pi \colon X \to T$ is the projection. We will denote by $\cal O(d)$ the pullback of $\cal O\_{\mathbb P^1}(d)$ to $X$. Let $x$ and $y$ be the coordinates on $\mathbb A^2$, and $u$ and $v$ the homogeneous coordinates on $\mathbb P^1$. Set $R = \mathbb C[x,y]$.


Let $F$ be the generic extension of ${\cal O}(1)$ by ${\cal O}(-2)$. We have an isomorphism
$Ext^1({\cal O}(1), {\cal O}(-2)) \simeq R^2$;
if $a$, $b$ denotes a basis of $Ext^1({\cal O}(1), {\cal O}(-2))$ as an $R$-module, then $F$ corresponds to the element $xa+yb$. By restricting to the fiber over $t$, we get the split exension for $t = (0,0)$, and a non-split extension for $t \neq (0,0)$. It is easy to see that $h^0(F\_t)$ is 2 for $t = (0,0)$ and 1 otherwise. We get an exact sequence
$$
0 \longrightarrow H^0(F) \longrightarrow H^0({\cal O}(1)) \longrightarrow H^1({\cal O}(-2))
$$
that is
$$
0 \longrightarrow H^0(F) \longrightarrow R^2 \longrightarrow R;
$$
the image of the boundary map $R^2 \longrightarrow R$ is the maximal ideal $(x,y)$. Hence, the composite $H^0(F) \to H^0({\cal O}(1)) \to H^0({\cal O}(1)\_{t\_0})$ is 0. Since $H^0(F\_{t\_0})$ maps isomorphically onto $H^0({\cal O}(1)\_{t\_0})$, we conclude that the restriction map $H^0(F) \to H^0(F\_{t\_0})$ is 0. This gives the counterexample.


This can be usefully viewed using the result of Grothendieck saying that, if $Y = \mathop{\rm Spec}R$, there is a finite $R$-module $Q$ such that for every finite $R$-module $M$ there is a canonical isomorphism of $R$-modules $H^0(X, F\otimes\_R M) \simeq Hom\_R(Q,M)$, which is functorial in $M$. In the counterexample above, $Q$ is the maximal ideal $(x,y)$. When $Y$ is 1-dimensional, we can use the structure theorem for modules over Dedekind rings, and conclude that $Q$ is the direct sum of a projective module and a torsion module. If $h^0(F\_t) \neq 0$ for all $t$, then the projective summand must be non-zero, so the statement does hold.


