Sometimes when dealing with models from a third party you’ll run into situations where the model was exported in a way that causes problems for the developer. One of the most common, but easiest to solve is when a model is exported at a position other than the origin (0, 0, 0). When you use a model that’s exported at a transposed position it can create issues with positioning from code, but thankfully there’s a very simple solution.
As you can see when I add the model to my scene and set the transform to the origin the mesh isn’t centered.
When you select the model in the project pane and look at the import settings, you can see that the transform is off.
This transform position will result in the mesh being positioned at the origin, but any code the sets the position would have to take this value into account.
To fix this we simple need to add an empty game object to the hierarchy and add our model as a child of that game object. We’ll adjust the mesh after adding it so that it’s on the origin, matching with the parent’s transform.
All you need to do from here is make that formerly empty GameObject into a prefab and you’re all set. You can follow the same approach with rotation issues as well.