If a regular polygon has a fixed edge length, can I know how many edges it has by knowing the length from corner to its center? So I wonder if there is a formula so that when there's a defined edge length, I can calculate a regular polygon's edges amount by knowing its length from corner to center, or vice versa. 
So let's say our defined edge length is 1, then by knowing the length from corner to center is $\frac{\sqrt2}{2}$, I knows it's a square. And if the length is one, I know it's a hexagon. 
 A: Yes. The quantity you are referring to is the radius of the polygon, and it has the formula
$$r=\frac{s}{2\sin\left(\frac{180}{n}\right)}$$
where $s$ is the side length of the polygon and $n$ is the number of sides. So given $r$ and $s$, you can simply solve the above equation for $n$.
A: Yes, and here is the logic of it. 
To show how, I've drawn a square, pentagon and hexagon. 
In each case, I've drawn the same construction lines - a circle that touches all their corners (we can do this with any regular polygon). I've labelled the length of the "defined edge" as $s$ and the length from corner to centre as $r$. I'm going to call the number of sides, $n$.
I've also marked a grey line that bisects the edge, from the centre. Because of the way I've positioned the line, it is a perpendicular bisector of the edge (crosses it at a right angle) so each half is a right angle triangle. The right angle triangle has one side $r$, and one side $s\big/2$, and I've labelled the angle these make at the centre, $A$.

Basic trigonometry says that for the right angle triangles, $$\begin{align}
\sin (A) &= \frac{\left[\dfrac s2\right]}r = \frac s{2r}\\
A &= sin^{-1} \left(\frac s{2r}\right)
\end{align}$$
But we also know that each edge, "takes up" $2\times A$ degrees, and so $n$ sides will "take up" $2\times A\times n$ degrees. But all $n$ sides must take up 360 degrees, the number of degrees at the centre. So $2\cdot A\cdot n = 360$.
Now we can solve the problem
Since $$\begin{align}
2An &= 360\\
An &= 180\\
\sin^{-1}\left(\frac s{2r}\right)\cdot n &= 180\\
n &= \frac{180}{\sin^{-1}\left(\dfrac s{2r}\right)}
\end{align}$$
Testing this with your square:
$s=1, r=\frac{\sqrt2}{2}$
$$\implies n = \frac{180}{\sin^{-1}\left(\dfrac{1}{2\cdot\dfrac{\sqrt2}{2}}\right)} = \frac{180}{45} = 4$$
So your example object was a square (4 sides).
Testing this with your hexagon:
$s=1, r=1$
$$\implies n = \frac{180}{\sin^{-1}\left(\dfrac{1}{2\cdot1}\right)} = \frac{180}{30} = 6$$
So your example object was a hexagon (6 sides).
