- Home /
Unity 2d space between sprites
The game I'm developing has side scrolling background.I have many background sprites and when the first background image exit from the bounds of screen, I add another background. when I add new backgrounds I simply check the width of background(all sprites have same width) sprite and,instantiate(while moving) after current background but it shows tiny line between background images.
renderer = mapObject.GetComponent<SpriteRenderer>();
mapWidth = renderer.bounds.size.x;
//instantiate new map to new position
addMap(newMap,new Vector3(mapWidth,0f,0f));
Is this problem occur because I instantiate the new sprite while moving the current one? or any ideas to solve this problem?
Answer by Dave-Carlile · Jul 17, 2015 at 01:00 PM
Unity has a blog post that outlines how to deal with pixel perfect 2D.
The most likely thing that will fix the space between your backgrounds is to create a material using the sprite shader and enable Pixel Snap. This is mentioned in the blog post.