Prove that the topologically transitive dynamical system $(X,f):\frac{1}{n}\sum_{k=0}^{n-1}\phi\circ f^k(x) \rightarrow g(x)$ is uniqualy ergodic 
Let $X$ be a compact metric space and the dynamical system $\big( X,f\big)$ is topologically transitivity (i.e The map $f$ is said to be transitive if for every pair of non-empty open sets $U, V \subset X$ there exists an integer $n$ such that $f^n(U) \cap V \ne \emptyset$.) 
If for every continuous function $\phi:X\rightarrow \mathbb R$ the sequence of functions:
$$\cfrac{1}{n}\sum_{k=0}^{n-1}\phi\circ f^k(x)$$
convergence uniformly, show that $f$ is $uniquely$ $ergodic$

Note: If $X$ is a compact metric space and $f : X \rightarrow X$ a continuous
map, then $f$ is said to be $uniquely$ $ergodic$ if
$$\cfrac{1}{n}\sum_{k=0}^{n-1}\phi\circ f^k(x)$$
converges to a constant uniformly for every continuous function $\phi$.

I assumed that there is a function $g$:  the sequence $\frac{1}{n}\sum_{k=0}^{n-1}\phi\circ f^k(x)\xrightarrow{n} g(x)$ , hence
$$d_{\infty}\left(\cfrac{1}{n}\sum_{k=0}^{n-1}\Big(\phi\circ f^k(x)-g(x)\Big),0 \right)\xrightarrow{n} 0$$
But i'm not sure how to use the topologically transitivity here, any clues?
Thank you.
 A: A first remark is to notice that the limit function $g$ is $f$ invariant, we will note $S_n (\phi) = \cfrac{1}{n}\sum_{k=0}^{n-1}\phi\circ f^k$, then $S_n(\phi) \to g$ and by continuity $S_n(\phi)\circ f \to g \circ f$. But $$
S_n(\phi) \circ f = \frac{n+1}{n}S_{n+1}-\frac{1}{n} \phi \to g
$$
so $g=g \circ f$.
Then suppose that $g$ is non constant that is there is $g(x)=a \ne b =g(y)$ for somme $x,y \in X$. Pick any $\epsilon >0$ such that $U_1=g^{-1}(]a-\epsilon,a+\epsilon[)$ and $U_2=g^{-1}(]b-\epsilon,b+\epsilon[)$ have empty intersection $U_1 \cap U_2 = \emptyset$. Then this two non-empty open set are also $f$ invariant (because $g$ is $f$ invariant) so there is no $n$ such that $f^n(U_1) \cap U_2 \ne \emptyset$ which contradict transitivity.

Just a remark, try to not write : the sequence of function $$
\cfrac{1}{n}\sum_{k=0}^{n-1}\phi\circ f^k(x)
$$
but instead $$
\cfrac{1}{n}\sum_{k=0}^{n-1}\phi\circ f^k
$$
and $$
d_{\infty}\left(\cfrac{1}{n}\sum_{k=0}^{n-1}\Big(\phi\circ f^k(x)-g(x)\Big),0 \right)\xrightarrow{n} 0
$$
Should be$$
d_{\infty}\left(\cfrac{1}{n}\sum_{k=0}^{n-1}\Big(\phi\circ f^k-g\Big),0 \right)\xrightarrow{n} 0
$$
