Regularized Urysohn function

I have been told to look for a regularized version of Urysohn functions, that is, a function which is non-zero in an open open set $U \subset \mathbb{R}$, is one restricted to a compact set $K$ contained in $U$, is zero outsdie $U$; and such that it is $\mathcal{C}^{\infty}(U)$.

I have found this

which looks pretty neat to me, but I am looking for an argument involving partitions of unity, if there is any.