title: Unity - How to combine sprites into one
body: <p>I want to make RPG game using Unity2d with the tile feature to draw the game map.</p>
  
  <p>I created a new class inherited from <code>UnityEngine.Tilemaps.Tile</code> and overrided <code>void GetTileData</code>.</p>
  
  <p>In <code>void GetTileData</code> I determine the <strong>sprite to show for each tile</strong> according to the tile's neighbors.</p>
  
  <p>See the image below. The source image is input from the inspector. The input is <strong>only one image</strong> like this below. I don't want to make massive input images caus that totally mess up.</p>
  
  <p>But then I have a problem. When in the game I have to extract certain blocks from the source image and combine them into a new sprite to show onto the map as a tile sprite.</p>
  
  <p><a href="https://i.stack.imgur.com/5JrwL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5JrwL.jpg" alt="enter image description here"></a></p>
  
  <blockquote>
    <p><strong>Just want to know, if I have the 4 rectangles known, and want to combine them into a sprite like the image above, how can I do that?</strong></p>
  </blockquote>