Mesh Position at double gameobject's position

Hello.

This is a GIF of my issue. 97862-planetgif2.gif

I have a dynamically created mesh created with the following code only once on start.
The gameobject’s mesh of a piece of the planet is at double the distance of the gameobject itself. The “global” and “local” positions are the same.

Turns out my issue was I had a bugged shader that was rendering the mesh in the wrong location.

How are you calling CreateMesh()? what is the value of “offset”?

I am willing to bet that you are passing the position of your gameobject here, when really all the vertices are in local coordinates to the game object it is attached to. So, it is adding the global position of the gameobject to the vertices, which become local positions relative to the game object. The result is that if the gameobject is at 0,0,10, the vertices will be at local coordinates 0,0,10, which means they are at GLOBAL coordinates 0,0,20.

This is easy to test, just hardcode offset to be Vector3.zero (or remove it entirely)