Flickering between objects placed up next to each other that are meant to look like one object?

I’m not really sure how to ask this or if this is the right subform, but…

I’m making a first-person perspective game with randomly-generated dungeons in which everything is snapped to a grid. To create the ‘physical’ dungeon, I’m creating cubes with length 1 with different textures for floors, walls, and ceilings, and placing them all exactly 1 unit apart from one another. So the floors and walls and ceiling are just a bunch of cubes placed next to each other.

While moving the player (and thus, camera) around inside these dungeons, there is often flickering lines between the various cubes. Not all at once, just random places you’ll see little lines flicker between some cubes. Is there something I can do to prevent this? I feel like this would be a problem people have had before in some way – putting two objects next to each other that are meant to look like a single object to the user.

Or is there a better way to build the physical dungeon besides placing tons of cubes? I’ve only made 2D games before and never had this kind of problem.

Are they actually cubes, meaning they have six sides, or have you deleted the faces that you think might not be visible? I had visible seams like that in my game after I converted from room based modules to wall based modules until I realized that I had joined some of the walls in Blender to make sure that they were textured as one and when I separated them some of the inner faces were gone. Those inner faces that you don’t think are visible were enough to close up the flickering.

It’s a floating point precision problem, the separate objects might be placed to line up perfectly, but when their separate vertexes get put through the math small precision errors lead to tiny gaps.

They are cubes, as in the thing that you get when you create a Cube t in Unity from the GameObject menu. I didn’t remove any faces or anything, just instantiated prefabs of them 1 unit apart from each other, and each one is 1 cubic unit. I don’t really know much about creating 3D assets and I’m not using any outside software. Just the Unity cubes. I plan to make everything else 2D most likely, unless I can find a volunteer to make 3D assets for the game (so… probably not) so it will only be the cubes that are needed.

This is what it looks like. The walls are two cubes high in this picture. Everything is aligned to a grid. When you move around, you can see flickering around the edges of the cubes sometimes. It especially happens on things further away, and especially on floors in spacious rooms (the floors are just a bunch of cubes next to each other, as is the ceiling).

The layout is dynamic and randomizes every time you get to an elevator, so I did the cubes. This is how I would have done it in a 2D game, just with square sprites.