- Home /
Sprites are in the wrong position in standalone, but look fine in the editor
I'm working on a 2D game and have found that there's a location where the roof sprites of a building are offset in the standalone version of the game, but don't appear that way in the editor. I've dumped out the position for the game objects and sprite renderer components, as well as the sort layers and orders, and found them to be identical in both versions. From manually moving the sprite in the editor, it appears that the Y value of the position is offset by roughly a value of 1. The sprites that this is happening to are a small number of sprites that make up a roof and this is the only place in the game where this is happening.
I took some captures in RenderDoc and found some concerning things. The difference seems to be coming from the vertex shader, the built-in Unity sprite one. It appears that the constant buffers that are feeding the vertex shaders have some concerning differences. In particular, there's a constant buffer that's the right size for a 4x4 matrix that has a NaN in the Y translation position in the standalone version. But not in the editor version, which has a zero there. There are also places where the editor buffers contain 1s, but the standalone ones contain 0s, highly suspicious given the NaN.
Your answer
Follow this Question
Related Questions
Sprite managed by Sprite Renderer doesn't shows up in play mode 0 Answers
2D game camera background between sprites 0 Answers
Unity 2D: query for "mask/layer" bit on screen space without collider 1 Answer
How do I get the sprite pointing the right direction? 1 Answer
Spritest look squashed and stretched in different screens. 1 Answer