Skip to main content
32 votes
Accepted

How to get all tiles from a Tilemap?

To get an array with all tiles from a rectangular area of your tilemap, use tilemap.GetTilesBlock(BoundsInt bounds). You will get a one-dimensional array of tiles, ...
Philipp's user avatar
  • 123k
30 votes
Accepted

What is the size limit to the Unity 2017.2 Tilemap?

Your RAM is your limit. The following tests were performed on a system with these specs: Intel i5-6600 16 GB RAM NVIDIA GeForce GTX 1070 Windows 7 Home Premium Here is a script I ran which grows a ...
Philipp's user avatar
  • 123k
19 votes

How to get all tiles from a Tilemap?

Here is another way to do it with .cellBounds.allPositionsWithin ...
allencoded's user avatar
18 votes
Accepted

Player gets stuck on edges between TilemapCollider2D tiles

After trying to write a code that merges the squares effectively (especially for large Tilemaps) both horizontally and vertically I decided to look if there is a better suited collider than the ...
BloodEchelon's user avatar
9 votes

Is there a name for this technique to put the tiles on the corner of a level?

It's a palette. Same thing you see some artists doing with colors. They draw a group of a couple of the main colors or even a gradient going between them for easy access. It's much easier to use a ...
Bálint's user avatar
  • 15.1k
8 votes
Accepted

How can I procedurally find a wall that separates two or more points on a grid-based map?

I will present a general concept and three solutions using that concept. Concept is an Influence map: For each location in the map, you are going to store a number that represent the distance to each ...
Theraot's user avatar
  • 28.2k
8 votes
Accepted

Strange warping/shimmering effect with Unity Tilemap and Cinemachine

Note that Cinemachine now has a Pixel Perfect extension that automates the kind of camera calculations I describe further down in this answer. Consider using that, and check the rest of this answer ...
DMGregory's user avatar
  • 141k
8 votes
Accepted

Is there a name for this technique to put the tiles on the corner of a level?

I don't know if there is a name, but this seems to be something you'd do to conserve memory. First, a basic tile is very low resolution - just a few pixels across. But when rendered, they are ...
Tim Holt's user avatar
  • 10.3k
7 votes
Accepted

How can I generate infinite boundary walls in PICO-8?

Sounds like you want to animate the walls down the screen so that it appears as though the player's ship is moving forward. Know that the PICO-8 Map is mainly for static backgrounds, so if you want a ...
Jay A. Little's user avatar
7 votes

How can I deal with tilemap position in the editor?

The select tool. Clicking any tile with the select tool, the inspector will tell you the position relative to 0,0. With a little bit of math (and/or additional clicks), you can hone in on whichever ...
Oberst's user avatar
  • 171
7 votes
Accepted

Tile palette off-centered

I fixed it by: 1.) Deleting my current tiles in the tile palette. 2.) In the inspector, after selecting the sprite that I wanted fixed properly on the tile palette, I changed the sprite's pivot ...
hanban's user avatar
  • 86
7 votes
Accepted

How do I sort edge tiles for a hex grid in order to draw a border?

The usual approach here is to pretend like you're solving a maze blindfolded: keep your left hand in contact with the wall, and follow its contours until you reach the exit (or in this case, until you ...
DMGregory's user avatar
  • 141k
6 votes
Accepted

Positioning tile sprites so they connect seamlessly

Using the Move tool (not the RectTransform tool) (Image from Unity docs) Hold the V key to enable vertex snapping, and hover over the corners of your sprite. The transform gizmo will snap to the ...
DMGregory's user avatar
  • 141k
5 votes

Elegant autotiling

I arrived here by Googling this problem myself, read the linked articles, and produced a relatively compact solution which generates the common set of 47 tiles. It requires a 2x3 tileset for the ...
Pennie Quinn's user avatar
5 votes
Accepted

Map generator sometimes doesn't work

You get an infinite loop. The statement that increases your counter in the while loop is inside an if statement that checks if the position is in bounds. Else it just sets ...
Gaze's user avatar
  • 166
5 votes

How do I sort edge tiles for a hex grid in order to draw a border?

I see you already have an answer to your question, but I'm going to add another answer for anyone who's trying to solve a simpler variant of the question. Civilization puts borders between hex tiles ...
amitp's user avatar
  • 6,116
5 votes
Accepted

How do I bitmask these tiles?

Your tileset is not ideal to use for autotiling, as many common pieces are missing, for example the L shape. I modified the tileset and used 160x160 wide tiles, this is the result: The blue ...
Jummit's user avatar
  • 341
5 votes
Accepted

How do I place objects so they snap to my TileMap in Godot?

Godot snaps to the grid guidelines and not the cells between them. So you won't snap to the middle of the square that you're dragging to. That's because you're snapping the position of the object (...
idbrii's user avatar
  • 1,088
4 votes
Accepted

How to make a noise gradient?

Here are two different ways I might approach this problem, showing how they change as the effect intensity is cranked up & down. The outermost column on each side is just my gradient, computed as ...
DMGregory's user avatar
  • 141k
4 votes
Accepted

How to avoid rows on screen when cutting spritesheet tiles?

Keep in mind that context.scale does not change the internal resolution of the canvas. It just adds a multiplication factor to all coordinates you pass to the drawing functions. Due to floating point ...
Philipp's user avatar
  • 123k
4 votes

Unity create Animated Tilemap?

If you are talking about the Random and Animated Tilemap Tiles tutorial available in the Unity website, then, you simply need to download and import the provided source below the video....
Hellium's user avatar
  • 2,949
4 votes
Accepted

How can I change a sprite used for a Unity Tilemap tile at runtime?

There are 2 ways to change a tile's sprite during runtime: Change tiles in a tilemap to a new tile (SetTiles or SwapTile) Change tile's sprite Both solution requires re-rendering of tiles. This is ...
knh190's user avatar
  • 221
4 votes
Accepted

Finding a path with minimal number of turns on a grid?

First fix your A* implementation so that it will find the shortest path. Adjust the cost of the turn instead of the heuristic. This means that when you generate the neighbours the one going straight ...
ratchet freak's user avatar
4 votes

Godot 3.1: procedurally generating TileMap with AutoTiles

This can be achieved with the update_bitmask_region() function in the TileMap class. Calling it with no parameters will update the whole tilemap, which is probably ...
Ignatiamus's user avatar
4 votes
Accepted

Tilemap missing collision options?

The way you edit tile collision shapes has changed in Godot 4. First click the TileSet assets in the tilemap inspector, and additional editing options appear. Add ...
Mangata's user avatar
  • 2,796
4 votes

How do I smoothly connect isometric tiles at different height levels?

I looked at this old question here: How to create tilted (height) isometric tiles. but I can't understand the solution of "shearing to the right, then rotate by 45 and scale in height". The ...
Isikyus's user avatar
  • 191
4 votes
Accepted

Is there a way to set custom data per cell in Godot 4?

I solved this problem by extending the TileMap class thus: ...
amkingTRP's user avatar
  • 198
3 votes
Accepted

Reading a text file and changing each digit into a value inside an array c#

With int.Parse(SR.ReadLine()) you are trying to convert the whole input line (consisting of 300 digits) into one single int. ...
Olivier Jacot-Descombes's user avatar
3 votes

How to pass the correct data into a continuous world

RESOLVED I solved my problem, I made the system based not on the keys but on the position of the player. Now this situation does not happen anymore. How I did it: 1 - I created a central rectangle. ...
PerduGames's user avatar
3 votes

How to pass the correct data into a continuous world

in the function ...
Jão's user avatar
  • 183

Only top scored, non community-wiki answers of a minimum length are eligible