Grid snapping alignment issue - any ideas? (Delivery Driver Unity Tutorial)

Hey, I can’t quite get the roads to snap together exactly (in the Delivery Driver Unity Tutorial), they’re always a few pixels off. I’ve taken a screenshot as an example and attached it to this post.

More info:
The grid snapping is set to on.
Pixels per unit for all road sprites is set to 75.
Main camera size is set to 14 (but that doesn’t affect the scene editor)

I have tried zooming in and out by different amounts, but can never see the roads snap properly :frowning:

Any ideas?

1 Like

Hi,

Check the Inspector of these game objects. Are there rounded position values or something like (9.123, 0.324, 0.0001)? If the latter, the grid snapping often does not work well. In this case, use rounded values such as (9, 0, 0).

Did this fix it?


See also:

2 Likes

Hi Nina, thank you for your suggestion, but unfortunately it didn’t fix the problem :frowning:

I did as you said and for one piece of road I set the position values to X =160, Y = -70, Z = 0 and also have the following set:

Tool handle set to Global.
Grid snapping on.
Snap increment set to X = 1, Y = 1, Z = 1.
Rotation set to X = 0, Y = 0, Z = 0.
Scale set to X = 1, Y = 1, Z = 1.
Grid snapping grid size set to X = 1, Y = 1, Z = 1 and set to All Axes

I then moved one of the pieces of road slightly while holding down the mouse button, but the new position snapped to X = 160.42, Y = -69.52, Z = 0. When I moved another piece of road toward it (which also had rounded values set), it also acquired strange decimal values and the two pieces of road just won’t align properly.

I’m baffled lol

1 Like

As far as I remember these roads don’t fit together the way you’d expect. You may have to just turn snapping off and fine-tune the positions manually.

2 Likes

Hmm manually aligning each individual road sprite with another is a pain I really want to avoid as it’s a big level I’ve put together! If at all possible, I was hoping the snapping tool was supposed to get rid of that particular aggravation! Argh!

It just seems so bizarre that when I move a piece of road, it “snaps” to a position +0.42 away instead of +1 away, when the snap increment is set to 1!

It doth boggle me good sir!

That’s often the problem with free assets: They are not always perfect. What you could do to solve the problem is to edit the sprites in, for example, Gimp and adjust them. That would be the best solution.

Alternatively, create a new game object with a child. Move the road sprite to the child. Adjust the relative position of the sprite as suggested by bixarrio. Then you’ll be able to move the parent with the enabled grid snapping.

1 Like

Fair enough, at this point I’m going to stop trying to get the grid snapping tool to work on these assets and just align manually!

However I did just notice this warning in the Inspector (at the bottom, red circle) when I highlight one of the road sprites - I’m still new to all of this so I’m not sure what it means, but could be part of the problem:

Map done! Thank you for helping Nina and bixarrio!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Good job! :slight_smile:

No, that’s not a problem, just a warning. Ideally, the resolution for a texture should be a multiple of 4, e.g. 4, 8, 16, 32, 64, 128, and so on. Maybe you recognise these numbers. If you work with shaders, you usually want to work with these for reasons of compatibility and performance optimisation. This is advanced knowledge, though, and definitely beyond the scope of this course, so don’t worry if you read about this the first time. You certainly don’t need this in little games.

See here:

1 Like

Privacy & Terms